Adds basic skeleton and tests for agentmanagement#5373
Conversation
This PR adds basic testing coverage skeleton and tests very basic things done by the agentmanagement component. Refers to: rancher#5372 Signed-off-by: Xavi Garcia <xavi.garcia@suse.com>
There was a problem hiding this comment.
Pull request overview
This PR adds a new envtest-backed Ginkgo integration test suite for the agentmanagement controller set, providing initial “smoke” and bootstrap-resource contract coverage to support future refactors (per #5372).
Changes:
- Introduces an
integrationtests/agentmanagementenvtest suite that boots the agentmanagement wrangler controllers. - Adds smoke tests asserting the controller harness starts and that bootstrap resources are applied.
- Adds contract-style tests that validate the exact bootstrap-created namespaces and ClusterRole policy rules.
Reviewed changes
Copilot reviewed 4 out of 4 changed files in this pull request and generated no comments.
| File | Description |
|---|---|
| integrationtests/agentmanagement/suite_test.go | Sets up envtest, seeds config, builds an app context, and registers/starts agentmanagement controllers for the suite. |
| integrationtests/agentmanagement/smoke_test.go | Basic smoke assertions that the harness started and bootstrap resources exist. |
| integrationtests/agentmanagement/resources_test.go | Contract tests for resources.ApplyBootstrapResources outputs (namespaces + exact ClusterRole rules + stability checks). |
| integrationtests/agentmanagement/helpers_test.go | Shared helper assertions/utilities for fetching objects from the envtest API server. |
💡 Add Copilot custom instructions for smarter, more guided reviews. Learn how to get started.
| It("starts the controllers without error", func() { | ||
| // Reaching here means BeforeSuite completed — envtest started, | ||
| // Wrangler controllers registered and started. | ||
| Expect(true).To(BeTrue()) |
There was a problem hiding this comment.
Thanks for the comment; I was confused here for a bit 😅
| // config.Register (called inside controllers.Register) does an | ||
| // initial config.Lookup and calls config.SetAndTrigger so | ||
| // config.Get() must return a non-nil value here. |
There was a problem hiding this comment.
Except config.SetAndTrigger(config.DefaultConfig() is now called explicitly from BeforeSuite, so I'm not sure what this test case brings 🤔
|
|
||
| Describe("system and registration namespaces", func() { | ||
| It("creates the system namespace", func() { | ||
| namespaceExists(systemNamespace).Should(Succeed()) |
There was a problem hiding this comment.
Isn't this redundant with the smoke tests?
This PR adds basic testing coverage skeleton and tests very basic things done by the agentmanagement component.
Refers to: #5372
Additional Information
Checklist
- [ ] I have updated the documentation via a pull request in the fleet-product-docs repository.