Skip to content

Commit

Permalink
fix: (storage) fix failing testcase (#12590) (#8965)
Browse files Browse the repository at this point in the history
[upstream:792432039b9662cb157de36c510aef85b84c5f88]

Signed-off-by: Modular Magician <[email protected]>
  • Loading branch information
modular-magician authored Dec 20, 2024
1 parent 175a321 commit 4ad1fe9
Show file tree
Hide file tree
Showing 2 changed files with 8 additions and 22 deletions.
3 changes: 3 additions & 0 deletions .changelog/12590.txt
Original file line number Diff line number Diff line change
@@ -0,0 +1,3 @@
```release-note:bug
storage: fix a failing testcase, create and update the bucket in same region
```
27 changes: 5 additions & 22 deletions google-beta/services/storage/resource_storage_bucket_test.go
Original file line number Diff line number Diff line change
Expand Up @@ -797,7 +797,6 @@ func TestAccStorageBucket_update(t *testing.T) {
t.Parallel()

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

Expand All @@ -806,27 +805,11 @@ func TestAccStorageBucket_update(t *testing.T) {
ProtoV5ProviderFactories: acctest.ProtoV5ProviderFactories(t),
CheckDestroy: testAccStorageBucketDestroyProducer(t),
Steps: []resource.TestStep{
{
Config: testAccStorageBucket_basic(bucketName),
Check: resource.ComposeTestCheckFunc(
testAccCheckStorageBucketExists(
t, "google_storage_bucket.bucket", bucketName, &bucket),
resource.TestCheckResourceAttr(
"google_storage_bucket.bucket", "force_destroy", "false"),
),
},
{
ResourceName: "google_storage_bucket.bucket",
ImportState: true,
ImportStateVerify: true,
ImportStateVerifyIgnore: []string{"force_destroy"},
},
{
Config: testAccStorageBucket_customAttributes(bucketName),
Check: resource.ComposeTestCheckFunc(
testAccCheckStorageBucketExists(
t, "google_storage_bucket.bucket", bucketName, &recreated),
testAccCheckStorageBucketWasRecreated(&recreated, &bucket),
t, "google_storage_bucket.bucket", bucketName, &bucket),
resource.TestCheckResourceAttr(
"google_storage_bucket.bucket", "force_destroy", "true"),
),
Expand All @@ -842,7 +825,7 @@ func TestAccStorageBucket_update(t *testing.T) {
Check: resource.ComposeTestCheckFunc(
testAccCheckStorageBucketExists(
t, "google_storage_bucket.bucket", bucketName, &updated),
testAccCheckStorageBucketWasUpdated(&updated, &recreated),
testAccCheckStorageBucketWasUpdated(&updated, &bucket),
resource.TestCheckResourceAttr(
"google_storage_bucket.bucket", "force_destroy", "true"),
),
Expand All @@ -858,7 +841,7 @@ func TestAccStorageBucket_update(t *testing.T) {
Check: resource.ComposeTestCheckFunc(
testAccCheckStorageBucketExists(
t, "google_storage_bucket.bucket", bucketName, &updated),
testAccCheckStorageBucketWasUpdated(&updated, &recreated),
testAccCheckStorageBucketWasUpdated(&updated, &bucket),
resource.TestCheckResourceAttr(
"google_storage_bucket.bucket", "force_destroy", "true"),
),
Expand All @@ -874,7 +857,7 @@ func TestAccStorageBucket_update(t *testing.T) {
Check: resource.ComposeTestCheckFunc(
testAccCheckStorageBucketExists(
t, "google_storage_bucket.bucket", bucketName, &updated),
testAccCheckStorageBucketWasUpdated(&updated, &recreated),
testAccCheckStorageBucketWasUpdated(&updated, &bucket),
resource.TestCheckResourceAttr(
"google_storage_bucket.bucket", "force_destroy", "true"),
),
Expand All @@ -890,7 +873,7 @@ func TestAccStorageBucket_update(t *testing.T) {
Check: resource.ComposeTestCheckFunc(
testAccCheckStorageBucketExists(
t, "google_storage_bucket.bucket", bucketName, &updated),
testAccCheckStorageBucketWasUpdated(&updated, &recreated),
testAccCheckStorageBucketWasUpdated(&updated, &bucket),
resource.TestCheckResourceAttr(
"google_storage_bucket.bucket", "force_destroy", "true"),
),
Expand Down

0 comments on commit 4ad1fe9

Please sign in to comment.