Skip to content

Commit

Permalink
update test case
Browse files Browse the repository at this point in the history
  • Loading branch information
gurusai-voleti committed Dec 17, 2024
1 parent 5bc5f4d commit a76cc25
Showing 1 changed file with 5 additions and 30 deletions.
Original file line number Diff line number Diff line change
Expand Up @@ -795,7 +795,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 @@ -804,26 +803,11 @@ func TestAccStorageBucket_update(t *testing.T) {
ProtoV5ProviderFactories: acctest.ProtoV5ProviderFactories(t),
CheckDestroy: testAccStorageBucketDestroyProducer(t),
Steps: []resource.TestStep{
{
Config: testAccStorageBucket(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),
t, "google_storage_bucket.bucket", bucketName, &bucket),
testAccCheckStorageBucketWasUpdated(&recreated, &bucket),
resource.TestCheckResourceAttr(
"google_storage_bucket.bucket", "force_destroy", "true"),
Expand All @@ -840,7 +824,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 @@ -856,7 +840,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 @@ -872,7 +856,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 @@ -888,7 +872,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 Expand Up @@ -1871,15 +1855,6 @@ resource "google_storage_bucket" "bucket" {
`, bucketName)
}

func testAccStorageBucket(bucketName string) string {
return fmt.Sprintf(`
resource "google_storage_bucket" "bucket" {
name = "%s"
location = "EU"
}
`, bucketName)
}

func testAccStorageBucket_basicWithAutoclass(bucketName string, autoclass bool) string {
return fmt.Sprintf(`
resource "google_storage_bucket" "bucket" {
Expand Down

0 comments on commit a76cc25

Please sign in to comment.