tags: make acceptance test resource names sweepable - #18980
Open
SirGitsalot wants to merge 1 commit into
Open
Conversation
Collaborator
|
Hi there, I'm the Modular magician. I've detected the following information about your changes for commit 103748f: Diff reportYour PR generated the following diffs in downstream repositories:
Test reportAnalytics
Affected Service Packages
Step 1: Replaying Mode Action takenFound 7 affected test(s) by replaying old test recordings. Starting RECORDING based on the most recent commit. Click here to see the affected tests
View the replaying VCR build log Step 2: Recording Mode
🟢 All tests passed! View the recording VCR build log or the debug logs folder for detailed results. @SirGitsalot VCR tests complete for 103748f! |
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.
The
tagsacceptance tests create tag keys and tag values whoseshort_namedoes not begin withtf-test, so the sweepers cannot recognize them and orphaned resources accumulate in the CI project when a test fails to clean up after itself. This prefixes 40 resource identifiers across 5 handwritten test files — tag key and tag valueshort_names, plus a supporting VPC.Two things here are worth a reviewer's attention:
"terraform.test." + acctest.RandString(t, 10)) rather thanfmt.Sprintf, so they are invisible to a search for format strings. They are fixed at the concatenation.short_namewas fully static with no random component at all, in at.Parallel()test. Because tag key short names must be unique within the parent and are immutable, that was a collision hazard between concurrent runs as well as a leak; it now carries a random suffix.Two tag value names are deliberately left unprefixed: they belong to tag keys that set
allowed_values_regexto^[a-z]+$and^[a-z0-9]+$, which a hyphenatedtf-test-prefix would violate. Prefixing them would make the tests fail, so they are left as-is.This is test-only; no resource or provider behavior changes and no test coverage is removed.
Verification: both providers regenerate and build cleanly,
go vetandgofmtpass, and the downstream diff is confined toservices/tags. Every renamed site was rendered with its arguments substituted and checked for cross-step name instability and for duplicate names of the same resource type within a config.