Skip to content

fix(ci): use unique names in macro append test to prevent flakiness#705

Closed
tembleking wants to merge 1 commit intomasterfrom
fix/flaky-macro-test
Closed

fix(ci): use unique names in macro append test to prevent flakiness#705
tembleking wants to merge 1 commit intomasterfrom
fix/flaky-macro-test

Conversation

@tembleking
Copy link
Copy Markdown
Member

The TestAccMacro test Step 5 (macroAppendToDefault) hardcodes the macro name "container" — a built-in Sysdig macro. When multiple CI runs execute concurrently against the same Sysdig environment, they collide with the error: "The field 'name' must not be the same as another Secure UI macro".

This is the same class of bug fixed in #697 for managed rulesets and custom policies.

The fix replaces the hardcoded built-in macro reference with a self-contained test that creates its own base macro with a unique terraform_test_ prefixed name, then appends to it. Also documents the "avoid name collisions" pattern in AGENTS.md.

@tembleking tembleking requested a review from a team as a code owner February 12, 2026 14:47
Copilot AI review requested due to automatic review settings February 12, 2026 14:47
@tembleking tembleking changed the title fix(test): use unique names in macro append test to prevent flakiness fix(ci): use unique names in macro append test to prevent flakiness Feb 12, 2026
@tembleking tembleking enabled auto-merge February 12, 2026 14:47
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

Updates the TestAccMacro acceptance test to avoid CI flakiness from Secure macro name collisions by generating unique macro names and avoiding built-in macros.

Changes:

  • Replace the hardcoded "container" macro usage with a uniquely named, test-owned macro.
  • Update the append test helper to accept a random suffix and build config via fmt.Sprintf.
  • Document best practices for avoiding name collisions in acceptance tests.

Reviewed changes

Copilot reviewed 2 out of 2 changed files in this pull request and generated 1 comment.

File Description
sysdig/resource_sysdig_secure_macro_test.go Makes the append test use a uniquely named macro instead of a built-in one to avoid CI collisions.
AGENTS.md Documents acceptance-test guidance to avoid shared-environment name collisions.

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

Comment thread sysdig/resource_sysdig_secure_macro_test.go
@tembleking
Copy link
Copy Markdown
Member Author

Re: Copilot's suggestion — the concern doesn't apply here. append = true macros are separate API objects with their own unique numeric IDs. All CRUD operations (read, update, delete) use the numeric ID, not the name, so there's no double-delete or state conflict.

This is the same pattern used elsewhere in the test suite (e.g., listAppendToDefault in list tests, ruleFalcoTerminalShellWithAppend in rule tests).

@tembleking
Copy link
Copy Markdown
Member Author

Closing, this is unneeded because the issue was actually in the infra we were testing with.

@tembleking tembleking closed this Feb 13, 2026
auto-merge was automatically disabled February 13, 2026 07:57

Pull request was closed

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

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

4 participants