Commit cd4d221
committed
Add unit tests for internal/state
Raise internal/state statement coverage from 37.8% to 97.2% with tests only.
Cover info_source (100%), manager SyncState/GetWatchSources/newStates error
paths, state_skel create/update/merge/getSyncState/isDaemonSetReady, driver
Sync/getManifestObjects/handleDefaultImagesInObjects/cleanupStaleDriverDaemonsets,
the GDS/GDRCopy/runtime spec helpers, driver spec/name/volume-config helpers,
and nodepool selection, using the controller-runtime fake client with
interceptors for injected errors and a fake manager where needed.
The ~2.8% that remains is the reachable ceiling: each uncovered statement is
either dead code (the getOSTag error branch that never fires; the SUSE
/lib/modules block gated by contradictory UsePrecompiledDrivers conditions),
a success return that loads the hardcoded on-disk path
/opt/gpu-operator/manifests/state-driver, a live-informer predicate closure in
GetWatchSources, or a provably-impossible SetNestedField error.
Signed-off-by: Abrar Shivani <ashivani@nvidia.com>1 parent f947746 commit cd4d221
7 files changed
Lines changed: 2374 additions & 0 deletions
0 commit comments