Commit 0d0d158
committed
Add unit tests for GetMCRegistryConf and IsDisconnectedOCP
Add comprehensive unit tests for the disconnected environment detection
and registry configuration retrieval functions in the util package.
Tests cover:
- IsNoMatchError: Detects both 'no matches for kind' (real API server) and
'no kind is registered' (fake client) errors
- IsDisconnectedOCP: Tests with ICSP, IDMS, both, empty lists, and
missing CRDs (graceful degradation)
- GetMCRegistryConf: Tests successful retrieval, missing MachineConfig,
missing CRD, invalid ignition format, missing base64 prefix, and
invalid base64 content
- Full scenario tests for disconnected environments and non-OpenShift
cluster graceful degradation
The IsNoMatchError function is updated to also detect 'no kind is registered'
errors which occur in functional tests where the fake client behaves
differently than a real Kubernetes API server.
The MachineConfigNotFound test verifies that IsNotFound errors are NOT
treated as IsNoMatchError - when the CRD exists but the resource doesn't,
this should be an error (not a warning), indicating misconfiguration.1 parent 7c45eb0 commit 0d0d158
File tree
2 files changed
+505
-2
lines changed- internal/dataplane/util
2 files changed
+505
-2
lines changed| Original file line number | Diff line number | Diff line change | |
|---|---|---|---|
| |||
81 | 81 | | |
82 | 82 | | |
83 | 83 | | |
84 | | - | |
85 | | - | |
| 84 | + | |
| 85 | + | |
| 86 | + | |
| 87 | + | |
| 88 | + | |
| 89 | + | |
| 90 | + | |
86 | 91 | | |
87 | 92 | | |
88 | 93 | | |
| |||
0 commit comments