Skip to content

Commit 1ec60e4

Browse files
Fixes failing test: TestAccStorageBucketIamPolicy_destroy (#14404) (#23458)
[upstream:13819614703d20ce332fdfaff74898ad909854d4] Signed-off-by: Modular Magician <[email protected]>
1 parent bed8cf9 commit 1ec60e4

File tree

2 files changed

+10
-5
lines changed

2 files changed

+10
-5
lines changed

.changelog/14404.txt

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1 @@
1+
unknown: Fixes failing test: TestAccStorageBucketIamPolicy_destroy

google/services/storage/iam_storage_bucket_test.go

Lines changed: 9 additions & 5 deletions
Original file line numberDiff line numberDiff line change
@@ -346,12 +346,16 @@ func TestAccStorageBucket_iamPolicyGeneratedWithCondition(t *testing.T) {
346346
func TestAccStorageBucketIamPolicy_destroy(t *testing.T) {
347347
t.Parallel()
348348

349+
context := map[string]interface{}{
350+
"random_suffix": acctest.RandString(t, 10),
351+
}
352+
349353
acctest.VcrTest(t, resource.TestCase{
350354
PreCheck: func() { acctest.AccTestPreCheck(t) },
351355
ProtoV5ProviderFactories: acctest.ProtoV5ProviderFactories(t),
352356
Steps: []resource.TestStep{
353357
{
354-
Config: testAccStorageBucketIamPolicy_destroy(),
358+
Config: testAccStorageBucketIamPolicy_destroy(context),
355359
},
356360
},
357361
})
@@ -617,14 +621,14 @@ resource "google_storage_bucket_iam_policy" "foo" {
617621
`, context)
618622
}
619623

620-
func testAccStorageBucketIamPolicy_destroy() string {
621-
return fmt.Sprintf(`
624+
func testAccStorageBucketIamPolicy_destroy(context map[string]interface{}) string {
625+
return acctest.Nprintf(`
622626
resource "google_service_account" "accessor" {
623627
account_id = "pub-sub-test-service-account"
624628
}
625629
626630
resource "google_storage_bucket" "test_bucket" {
627-
name = "sd-pubsub-test-bucket"
631+
name = "tf-test-my-bucket%{random_suffix}"
628632
location = "US"
629633
storage_class = "STANDARD"
630634
@@ -674,5 +678,5 @@ resource "google_pubsub_topic_iam_policy" "topic_policy" {
674678
topic = google_pubsub_topic.topic.name
675679
policy_data = data.google_iam_policy.topic_policy_data.policy_data
676680
}
677-
`)
681+
`, context)
678682
}

0 commit comments

Comments
 (0)