Skip to content

tags: make acceptance test resource names sweepable - #18980

Open
SirGitsalot wants to merge 1 commit into
GoogleCloudPlatform:mainfrom
SirGitsalot:fix-tags-sweepable
Open

tags: make acceptance test resource names sweepable#18980
SirGitsalot wants to merge 1 commit into
GoogleCloudPlatform:mainfrom
SirGitsalot:fix-tags-sweepable

Conversation

@SirGitsalot

Copy link
Copy Markdown
Member

The tags acceptance tests create tag keys and tag values whose short_name does not begin with tf-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 value short_names, plus a supporting VPC.

Two things here are worth a reviewer's attention:

  • Six of these names are built by Go string concatenation ("terraform.test." + acctest.RandString(t, 10)) rather than fmt.Sprintf, so they are invisible to a search for format strings. They are fixed at the concatenation.
  • One tag key short_name was fully static with no random component at all, in a t.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_regex to ^[a-z]+$ and ^[a-z0-9]+$, which a hyphenated tf-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 vet and gofmt pass, and the downstream diff is confined to services/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.

@modular-magician

modular-magician commented Sep 12, 2026

Copy link
Copy Markdown
Collaborator

Hi there, I'm the Modular magician. I've detected the following information about your changes for commit 103748f:

Diff report

Your PR generated the following diffs in downstream repositories:

Repository Diff Link Changes
google provider View Diff 5 files changed, 40 insertions(+), 40 deletions(-)
google-beta provider View Diff 5 files changed, 40 insertions(+), 40 deletions(-)

Test report

Analytics

Total Tests Passed Skipped Affected
21 14 0 7
Affected Service Packages
  • tags

Learn how VCR tests work


Step 1: Replaying Mode

Action taken

Found 7 affected test(s) by replaying old test recordings. Starting RECORDING based on the most recent commit.

Click here to see the affected tests
  • TestAccDataSourceGoogleTagsTagKey_dot
  • TestAccDataSourceGoogleTagsTagKey_withRegex
  • TestAccDataSourceGoogleTagsTagKeys_dot
  • TestAccDataSourceGoogleTagsTagKeys_withRegex
  • TestAccDataSourceGoogleTagsTagValue_dot
  • TestAccDataSourceGoogleTagsTagValues_dot
  • TestAccTags

View the replaying VCR build log


Step 2: Recording Mode

Recording Mode Replaying Rerun Test Name
✅ Log TestAccDataSourceGoogleTagsTagKey_dot
✅ Log TestAccDataSourceGoogleTagsTagKey_withRegex
✅ Log TestAccDataSourceGoogleTagsTagKeys_dot
✅ Log TestAccDataSourceGoogleTagsTagKeys_withRegex
✅ Log TestAccDataSourceGoogleTagsTagValue_dot
✅ Log TestAccDataSourceGoogleTagsTagValues_dot
✅ Log TestAccTags/tagBindingBasic
✅ Log TestAccTags/tagBindingBasicDynamic
✅ Log TestAccTags/tagBindingNamespaced
✅ Log TestAccTags/tagKeyBasic
✅ Log TestAccTags/tagKeyBasicWithAllowedValuesRegex
✅ Log TestAccTags/tagKeyBasicWithPurposeDataGovernance
✅ Log TestAccTags/tagKeyBasicWithPurposeGceFirewall
✅ Log TestAccTags/tagKeyIamBinding
✅ Log TestAccTags/tagKeyIamMember
✅ Log TestAccTags/tagKeyIamPolicy
✅ Log TestAccTags/tagKeyUpdate
✅ Log TestAccTags/tagKeyUpdateAllowedValuesRegex
✅ Log TestAccTags/tagValueBasic
✅ Log TestAccTags/tagValueIamBinding
✅ Log TestAccTags/tagValueIamMember
✅ Log TestAccTags/tagValueIamPolicy
✅ Log TestAccTags/tagValueUpdate
✅ Log TestAccTags/tagsLocationTagBindingBasic
✅ Log TestAccTags/tagsLocationTagBindingBasicDynamic
✅ Log TestAccTags/tagsLocationTagBindingBasicWithProjectId
✅ Log TestAccTags/tagsLocationTagBindingZonal
✅ Log TestAccTags/tagsLocationTagBindingZonalDynamic
✅ Log TestAccTags/tagsLocationTagBindingZonalNamespaced

🟢 All tests passed!

View the recording VCR build log or the debug logs folder for detailed results.

@SirGitsalot VCR tests complete for 103748f!

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

Projects

None yet

Development

Successfully merging this pull request may close these issues.

2 participants