agentmanagement: config and cluster testing coverage.#5405
Conversation
This PR adds testing coverage for the config and cluster controllers in the agentmanagement. Signed-off-by: Xavi Garcia <xavi.garcia@suse.com>
There was a problem hiding this comment.
Pull request overview
This PR adds envtest-based integration coverage for Fleet’s agentmanagement controllers, focusing on the global config ConfigMap watch behavior and cluster namespace lifecycle behavior.
Changes:
- Add integration tests validating the manager ConfigMap watch updates
config.Get()on create/update and is a no-op on delete. - Add integration tests validating cluster namespace creation/labeling/annotation behavior and edge cases (custom management label, preexisting namespace, deletion behavior).
- Extend shared agentmanagement integration test helpers with constructors/utilities for ConfigMaps, generated namespaces, and Fleet resources.
Reviewed changes
Copilot reviewed 3 out of 3 changed files in this pull request and generated 1 comment.
| File | Description |
|---|---|
| integrationtests/agentmanagement/helpers_test.go | Adds helper constructors/utilities for config, clusters, bundledeployments, and generated namespaces. |
| integrationtests/agentmanagement/config_test.go | New tests for the global config ConfigMap watch behavior and filtering logic. |
| integrationtests/agentmanagement/cluster_test.go | New tests for cluster-generated namespace lifecycle and bundledeployment-triggered reconciles. |
💡 Add Copilot custom instructions for smarter, more guided reviews. Learn how to get started.
| }) | ||
|
|
||
| Describe("bundledeployment changes", func() { | ||
| It("does not error or create any namespace when a BundleDeployment changes in a namespace without cluster annotations", func() { |
There was a problem hiding this comment.
Could we check that the opposite also works? i.e. a namespace may be created when a bundle deployment changes in a namespace with cluster annotations.
There was a problem hiding this comment.
Good catch!. Added a test for the positive branch — and it exposed that my existing annotated-namespace spec couldn't fail anyway: the cluster namespace already exists when the BundleDeployment is created, so the watch firing has no observable effect.
There was a problem hiding this comment.
Thanks for adding this new test case :)
and it exposed that my existing annotated-namespace spec couldn't fail anyway: the cluster namespace already exists when the BundleDeployment is created, so the watch firing has no observable effect.
Does this mean that the negative test case should delete the cluster namespace, as the positive test case does, to ensure that the watch is fired?
Signed-off-by: Xavi Garcia <xavi.garcia@suse.com>
This PR adds testing coverage for the config and cluster controllers in the agentmanagement.