test: add e2e tests to validate resourceoverride namespace isolation #293
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.
Overview
This PR adds two new e2e test cases to verify that a
ResourceOverridein one namespace won't override resources in another namespace, ensuring proper namespace isolation.Problem
We needed to validate that when a
ResourceOverrideis created in a specific namespace and references a placement (eitherClusterResourcePlacementorResourcePlacement), it only affects resources within that namespace and doesn't leak to other namespaces.Solution
Added two comprehensive test cases following existing test patterns:
1. ClusterResourcePlacement (CRP) Test Case
Located in
test/e2e/placement_ro_test.go, this test:namespace-Aandnamespace-B) with their own ConfigMapsClusterResourcePlacementresources (CRP-A for namespace-A, CRP-B for namespace-B)ResourceOverridein namespace-A that references CRP-A and adds annotationsConsistently)2. ResourcePlacement (RP) Test Case
Located in
test/e2e/resource_placement_ro_test.go, this test:ResourcePlacementresources (RP-A in namespace-A, RP-B in namespace-B)ResourceOverridein namespace-A that references RP-A and adds annotationsConsistently)Additional Changes
cleanupNamespacefunction intest/e2e/utils_test.goto support test cleanup by deleting namespaces from the hub clustercmpoptsimport for more precise annotation comparison in test assertionsmake reviewableand follows existing test patternsTesting
The tests:
Eventually/Consistentlypatterns for async verificationResolves the issue by providing comprehensive validation of namespace isolation for
ResourceOverridefunctionality.Original prompt
Fixes #71
💬 Share your feedback on Copilot coding agent for the chance to win a $200 gift card! Click here to start the survey.