Skip to content

[281#2] refactor(srb): migrate SRB controller to shared metadata package#288

Closed
mpechkurov wants to merge 1 commit into
feat/metadata-packagefrom
refactor/srb-metadata-migration
Closed

[281#2] refactor(srb): migrate SRB controller to shared metadata package#288
mpechkurov wants to merge 1 commit into
feat/metadata-packagefrom
refactor/srb-metadata-migration

Conversation

@mpechkurov
Copy link
Copy Markdown
Collaborator

What

  • Remove ~45 lines of duplicated isMetadataUpToDate/metadataMapEqual from SRB controller
  • Replace with shared metadata.IsMetadataUpToDate and metadata.MetadataMapContains
  • Adopts correct merge-patch semantics (subset check via MetadataMapContains) instead of exact equality
  • Denest nil-mg test case in metadata_test.go

Test Changes

  • ExtraLabelInActual: false → true (desired is subset of actual)
  • SpecWithoutMetadataBindingHasLabels: false → true (empty desired is subset of anything)

Part of

Split from #281 — PR 2 of 6. Depends on [281#1].

Merge order: [281#1] → [281#2] → [281#3] → [281#4] → [281#5] → [281#6]

Move the "nil managed resource" test case from a nested position inside
the "nil pointer value overrides default label" test to a top-level
t.Run sibling in TestBuildMetadata.

Replace SRB controller's local isMetadataUpToDate and metadataMapEqual
helpers with metadata.IsMetadataUpToDate and metadata.MetadataMapContains
from the shared metadata package. This adopts correct merge-patch
semantics (subset check via MetadataMapContains) instead of exact
equality, and removes ~45 lines of duplicated logic.

Update two SRB test expectations for subset semantics:
- ExtraLabelInActual: false -> true (desired is subset of actual)
- SpecWithoutMetadataBindingHasLabels: false -> true (empty desired
  is subset of anything)

[281#2]
@SatabdiG
Copy link
Copy Markdown
Collaborator

Closing as #281 received review comments.

@SatabdiG SatabdiG closed this May 27, 2026
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

2 participants