Skip to content

Adds basic skeleton and tests for agentmanagement#5373

Open
0xavi0 wants to merge 1 commit into
rancher:mainfrom
0xavi0:tests-agentmanagement-skeleton-basics
Open

Adds basic skeleton and tests for agentmanagement#5373
0xavi0 wants to merge 1 commit into
rancher:mainfrom
0xavi0:tests-agentmanagement-skeleton-basics

Conversation

@0xavi0

@0xavi0 0xavi0 commented Jun 30, 2026

Copy link
Copy Markdown
Contributor

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.

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>
@0xavi0 0xavi0 added this to the v2.16.0 milestone Jun 30, 2026
@0xavi0 0xavi0 self-assigned this Jun 30, 2026
@0xavi0 0xavi0 added this to Fleet Jun 30, 2026
@0xavi0 0xavi0 marked this pull request as ready for review June 30, 2026 14:46
@0xavi0 0xavi0 requested a review from a team as a code owner June 30, 2026 14:46
Copilot AI review requested due to automatic review settings June 30, 2026 14:46

Copilot AI left a comment

Copy link
Copy Markdown
Contributor

Choose a reason for hiding this comment

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

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/agentmanagement envtest 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())

Copy link
Copy Markdown
Contributor

Choose a reason for hiding this comment

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

Thanks for the comment; I was confused here for a bit 😅

Comment on lines +19 to +21
// 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.

Copy link
Copy Markdown
Contributor

Choose a reason for hiding this comment

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

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())

Copy link
Copy Markdown
Contributor

Choose a reason for hiding this comment

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

Isn't this redundant with the smoke tests?

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Projects

Status: No status

Development

Successfully merging this pull request may close these issues.

3 participants