Skip to content

Commit 2a6fedd

Browse files
fix: (storage) fix failing testcase (#12590) (#20771)
[upstream:792432039b9662cb157de36c510aef85b84c5f88] Signed-off-by: Modular Magician <magic-modules@google.com>
1 parent ef55381 commit 2a6fedd

File tree

2 files changed

+8
-22
lines changed

2 files changed

+8
-22
lines changed

.changelog/12590.txt

Lines changed: 3 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,3 @@
1+
```release-note:bug
2+
storage: fix a failing testcase, create and update the bucket in same region
3+
```

google/services/storage/resource_storage_bucket_test.go

Lines changed: 5 additions & 22 deletions
Original file line numberDiff line numberDiff line change
@@ -797,7 +797,6 @@ func TestAccStorageBucket_update(t *testing.T) {
797797
t.Parallel()
798798

799799
var bucket storage.Bucket
800-
var recreated storage.Bucket
801800
var updated storage.Bucket
802801
bucketName := fmt.Sprintf("tf-test-acl-bucket-%d", acctest.RandInt(t))
803802

@@ -806,27 +805,11 @@ func TestAccStorageBucket_update(t *testing.T) {
806805
ProtoV5ProviderFactories: acctest.ProtoV5ProviderFactories(t),
807806
CheckDestroy: testAccStorageBucketDestroyProducer(t),
808807
Steps: []resource.TestStep{
809-
{
810-
Config: testAccStorageBucket_basic(bucketName),
811-
Check: resource.ComposeTestCheckFunc(
812-
testAccCheckStorageBucketExists(
813-
t, "google_storage_bucket.bucket", bucketName, &bucket),
814-
resource.TestCheckResourceAttr(
815-
"google_storage_bucket.bucket", "force_destroy", "false"),
816-
),
817-
},
818-
{
819-
ResourceName: "google_storage_bucket.bucket",
820-
ImportState: true,
821-
ImportStateVerify: true,
822-
ImportStateVerifyIgnore: []string{"force_destroy"},
823-
},
824808
{
825809
Config: testAccStorageBucket_customAttributes(bucketName),
826810
Check: resource.ComposeTestCheckFunc(
827811
testAccCheckStorageBucketExists(
828-
t, "google_storage_bucket.bucket", bucketName, &recreated),
829-
testAccCheckStorageBucketWasRecreated(&recreated, &bucket),
812+
t, "google_storage_bucket.bucket", bucketName, &bucket),
830813
resource.TestCheckResourceAttr(
831814
"google_storage_bucket.bucket", "force_destroy", "true"),
832815
),
@@ -842,7 +825,7 @@ func TestAccStorageBucket_update(t *testing.T) {
842825
Check: resource.ComposeTestCheckFunc(
843826
testAccCheckStorageBucketExists(
844827
t, "google_storage_bucket.bucket", bucketName, &updated),
845-
testAccCheckStorageBucketWasUpdated(&updated, &recreated),
828+
testAccCheckStorageBucketWasUpdated(&updated, &bucket),
846829
resource.TestCheckResourceAttr(
847830
"google_storage_bucket.bucket", "force_destroy", "true"),
848831
),
@@ -858,7 +841,7 @@ func TestAccStorageBucket_update(t *testing.T) {
858841
Check: resource.ComposeTestCheckFunc(
859842
testAccCheckStorageBucketExists(
860843
t, "google_storage_bucket.bucket", bucketName, &updated),
861-
testAccCheckStorageBucketWasUpdated(&updated, &recreated),
844+
testAccCheckStorageBucketWasUpdated(&updated, &bucket),
862845
resource.TestCheckResourceAttr(
863846
"google_storage_bucket.bucket", "force_destroy", "true"),
864847
),
@@ -874,7 +857,7 @@ func TestAccStorageBucket_update(t *testing.T) {
874857
Check: resource.ComposeTestCheckFunc(
875858
testAccCheckStorageBucketExists(
876859
t, "google_storage_bucket.bucket", bucketName, &updated),
877-
testAccCheckStorageBucketWasUpdated(&updated, &recreated),
860+
testAccCheckStorageBucketWasUpdated(&updated, &bucket),
878861
resource.TestCheckResourceAttr(
879862
"google_storage_bucket.bucket", "force_destroy", "true"),
880863
),
@@ -890,7 +873,7 @@ func TestAccStorageBucket_update(t *testing.T) {
890873
Check: resource.ComposeTestCheckFunc(
891874
testAccCheckStorageBucketExists(
892875
t, "google_storage_bucket.bucket", bucketName, &updated),
893-
testAccCheckStorageBucketWasUpdated(&updated, &recreated),
876+
testAccCheckStorageBucketWasUpdated(&updated, &bucket),
894877
resource.TestCheckResourceAttr(
895878
"google_storage_bucket.bucket", "force_destroy", "true"),
896879
),

0 commit comments

Comments
 (0)