fix(test): use unique names in tests to prevent flakiness#697
Merged
tembleking merged 2 commits intomasterfrom Feb 6, 2026
Merged
fix(test): use unique names in tests to prevent flakiness#697tembleking merged 2 commits intomasterfrom
tembleking merged 2 commits intomasterfrom
Conversation
The test was using a hardcoded name "Sysdig Runtime Threat Detection (Copy)" which caused name collisions when tests ran in parallel or when previous test runs didn't clean up properly. Generate a random suffix once and use it consistently across all test steps.
Contributor
There was a problem hiding this comment.
Pull request overview
This PR fixes a flaky test in the managed ruleset acceptance test by ensuring unique resource names across parallel test executions and avoiding collisions from incomplete cleanup of previous test runs.
Changes:
- Generate a single random suffix once at test start instead of calling
rText()multiple times - Update all config helper functions to accept and use the random suffix parameter
- Replace hardcoded "Sysdig Runtime Threat Detection (Copy)" names with unique suffixed names
💡 Add Copilot custom instructions for smarter, more guided reviews. Learn how to get started.
The test was using format placeholders %s but never calling fmt.Sprintf, causing the literal "%s" to be used as the policy name. This led to name collisions when tests ran in parallel. Add fmt.Sprintf to properly interpolate the random suffix.
davidag
approved these changes
Feb 6, 2026
fcracker79
pushed a commit
that referenced
this pull request
Mar 5, 2026
## Summary - Use random suffixes to generate unique names in tests that create resources with unique name constraints - Prevents name collisions when tests run in parallel or when previous test runs don't clean up properly ### Fixed tests: - `resource_sysdig_secure_managed_ruleset_test.go`: Use `randomText(10)` for managed ruleset names - `data_source_sysdig_secure_custom_policy_test.go`: Add missing `fmt.Sprintf` call to properly interpolate random suffix ### Root cause Tests were using hardcoded names or format placeholders without `fmt.Sprintf`, causing: - `"The field 'name' must be unique per policy type"` errors - Test failures in CI when running in parallel Fixes: https://github.com/sysdiglabs/terraform-provider-sysdig/actions/runs/21728344935/job/62676378457
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
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.
Summary
Fixed tests:
resource_sysdig_secure_managed_ruleset_test.go: UserandomText(10)for managed ruleset namesdata_source_sysdig_secure_custom_policy_test.go: Add missingfmt.Sprintfcall to properly interpolate random suffixRoot cause
Tests were using hardcoded names or format placeholders without
fmt.Sprintf, causing:"The field 'name' must be unique per policy type"errorsFixes: https://github.com/sysdiglabs/terraform-provider-sysdig/actions/runs/21728344935/job/62676378457