further prep for integration tests#145
Merged
Merged
Conversation
Signed-off-by: Alex Price <aprice@atlassian.com>
569c326 to
b967ee3
Compare
hligit
approved these changes
May 25, 2026
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
Add this suggestion to a batch that can be applied as a single commit.This suggestion is invalid because no changes were made to the code.Suggestions cannot be applied while the pull request is closed.Suggestions cannot be applied while viewing a subset of changes.Only one suggestion per line can be applied in a batch.Add this suggestion to a batch that can be applied as a single commit.Applying suggestions on deleted lines is not supported.You must change the existing code in this line in order to create a valid suggestion.Outdated suggestions cannot be applied.This suggestion has been applied or marked resolved.Suggestions cannot be applied from pending reviews.Suggestions cannot be applied on multi-line comments.Suggestions cannot be applied while the pull request is queued to merge.Suggestion cannot be applied right now. Please check back later.
Further prep for integration tests
Follow-up to #144. Two production changes and their unit tests.
Changes
pkg/k8s— use merge patch for node annotations and labelsAddAnnotationToNodeandAddLabelToNodepreviously used a JSON Patch"add"operation. This fails at the apiserver when the node'smetadata.annotations/metadata.labelsmap is nil — something thathappens in envtest (no kubelet to initialise the map) and occasionally in
real clusters before a kubelet has written its own annotations.
Both functions now use a strategic merge patch via the new
MergePatchNodehelper, which the apiserver handles correctly regardless of whether the map
exists. Behaviour in normal clusters is identical.
8 unit tests added in
pkg/k8s/node_test.go, including an explicitnil-annotations case that would have failed before this change.
pkg/manager— extract controller wiring intoRuncmd/manager/main.goused to inline scheme registration and all threereconciler registrations. The integration test
worldpackage had toduplicate that wiring, meaning any future change to controller setup could
silently diverge between production and tests.
pkg/manager.Run(ctx, mgr, deps)is now the single place that registersthe cyclops scheme, metrics, and all three controllers.
cmd/manager/main.goand the integration test suite both call it.2 unit tests added in
pkg/manager/manager_test.go.