Skip to content

Commit c887b98

Browse files
Fix TestAccSqlUser_postgresIAM by using a real IAM user (#10731) (#7402)
[upstream:45be142d046f4aa453fd4d02c092508860718a0c] Signed-off-by: Modular Magician <[email protected]>
1 parent ac878b3 commit c887b98

File tree

1 file changed

+9
-9
lines changed

1 file changed

+9
-9
lines changed

google-beta/services/sql/resource_sql_user_test.go

Lines changed: 9 additions & 9 deletions
Original file line numberDiff line numberDiff line change
@@ -138,10 +138,10 @@ func TestAccSqlUser_postgres(t *testing.T) {
138138
}
139139

140140
func TestAccSqlUser_postgresIAM(t *testing.T) {
141-
t.Skipf("Skipping test %s due to https://github.com/hashicorp/terraform-provider-google/issues/16704", t.Name())
142141
t.Parallel()
143142

144143
instance := fmt.Sprintf("tf-test-%d", acctest.RandInt(t))
144+
const iamUser = "[email protected]"
145145
acctest.VcrTest(t, resource.TestCase{
146146
PreCheck: func() { acctest.AccTestPreCheck(t) },
147147
ProtoV5ProviderFactories: acctest.ProtoV5ProviderFactories(t),
@@ -151,14 +151,14 @@ func TestAccSqlUser_postgresIAM(t *testing.T) {
151151
CheckDestroy: testAccSqlUserDestroyProducer(t),
152152
Steps: []resource.TestStep{
153153
{
154-
Config: testGoogleSqlUser_postgresIAM(instance),
154+
Config: testGoogleSqlUser_postgresIAM(instance, iamUser),
155155
Check: resource.ComposeTestCheckFunc(
156156
testAccCheckGoogleSqlUserExists(t, "google_sql_user.user"),
157157
),
158158
},
159159
{
160160
ResourceName: "google_sql_user.user",
161-
ImportStateId: fmt.Sprintf("%s/%s/admin", envvar.GetTestProjectFromEnv(), instance),
161+
ImportStateId: fmt.Sprintf("%s/%s/%s", envvar.GetTestProjectFromEnv(), instance, iamUser),
162162
ImportState: true,
163163
ImportStateVerify: true,
164164
ImportStateVerifyIgnore: []string{"password"},
@@ -406,7 +406,7 @@ resource "google_sql_user" "user" {
406406
`, instance, password)
407407
}
408408

409-
func testGoogleSqlUser_postgresIAM(instance string) string {
409+
func testGoogleSqlUser_postgresIAM(instance, iamUser string) string {
410410
return fmt.Sprintf(`
411411
resource "google_sql_database_instance" "instance" {
412412
name = "%s"
@@ -424,19 +424,19 @@ resource "google_sql_database_instance" "instance" {
424424
}
425425
426426
# TODO: Remove with resolution of https://github.com/hashicorp/terraform-provider-google/issues/14233
427-
resource "time_sleep" "wait_30_seconds" {
427+
resource "time_sleep" "wait_60_seconds" {
428428
depends_on = [google_sql_database_instance.instance]
429429
430-
create_duration = "30s"
430+
create_duration = "60s"
431431
}
432432
433433
resource "google_sql_user" "user" {
434-
depends_on = [time_sleep.wait_30_seconds]
435-
name = "admin"
434+
depends_on = [time_sleep.wait_60_seconds]
435+
name = "%s"
436436
instance = google_sql_database_instance.instance.name
437437
type = "CLOUD_IAM_USER"
438438
}
439-
`, instance)
439+
`, instance, iamUser)
440440
}
441441

442442
func testGoogleSqlUser_postgresAbandon(instance, name string) string {

0 commit comments

Comments
 (0)