Skip to content

Add tests for namespace label sync#5202

Merged
thardeck merged 1 commit into
mainfrom
retain_relevant_labels_tests
May 28, 2026
Merged

Add tests for namespace label sync#5202
thardeck merged 1 commit into
mainfrom
retain_relevant_labels_tests

Conversation

@thardeck
Copy link
Copy Markdown
Collaborator

Adds pod-security label filtering tests and a table case verifying no-op behaviour when the namespace already reflects the desired state.

  • TestAddLabelsFromOptions_PodSecurityLabelsFiltered: covers the rule that pod-security.kubernetes.io/* labels from NamespaceLabels options are never applied to the namespace, while existing pod-security labels on the namespace are preserved.
  • TestSetNamespaceLabelsAndAnnotations_PodSecurityLabelsPreserved: end-to-end check through setNamespaceLabelsAndAnnotations confirming pod-security labels on the namespace survive a sync.

@thardeck thardeck self-assigned this May 28, 2026
Copilot AI review requested due to automatic review settings May 28, 2026 08:18
@thardeck thardeck requested a review from a team as a code owner May 28, 2026 08:18
Copy link
Copy Markdown
Contributor

Copilot AI left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Pull request overview

Adds test coverage around namespace label synchronization, especially ensuring pod-security labels are filtered from bundle options while existing namespace pod-security labels are preserved.

Changes:

  • Adds table coverage for addLabelsFromOptions pod-security label filtering.
  • Adds an end-to-end namespace sync test preserving existing pod-security labels.
  • Adds a namespace sync table case for an already-matching namespace state.

💡 Add Copilot custom instructions for smarter, more guided reviews. Learn how to get started.

Comment thread internal/cmd/agent/deployer/deployer_test.go Outdated
Adds coverage for the pod-security label filtering introduced by the
namespace label sync fix:
- TestAddLabelsFromOptions_PodSecurityLabelsFiltered: pod-security labels
  from NamespaceLabels options are never applied to the namespace while
  existing pod-security labels on the namespace are preserved.
- TestSetNamespaceLabelsAndAnnotations_PodSecurityLabelsPreserved:
  end-to-end check through setNamespaceLabelsAndAnnotations confirming
  pod-security labels on the namespace survive a sync.
Copy link
Copy Markdown
Contributor

@sbulage sbulage left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

LGTM 👍

@thardeck thardeck enabled auto-merge (squash) May 28, 2026 10:10
@thardeck thardeck merged commit 7b92203 into main May 28, 2026
35 of 36 checks passed
@thardeck thardeck deleted the retain_relevant_labels_tests branch May 28, 2026 10:29
@github-project-automation github-project-automation Bot moved this from 👀 In review to ✅ Done in Fleet May 28, 2026
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

Status: ✅ Done

Development

Successfully merging this pull request may close these issues.

3 participants