Skip to content

Commit a5f2175

Browse files
Fixed apigee organization deletion tests by adding sleep (#15729) (#11116)
[upstream:67209c08c98f54786709f25890530fc233a28f33] Signed-off-by: Modular Magician <[email protected]>
1 parent 9a99c37 commit a5f2175

File tree

1 file changed

+92
-22
lines changed

1 file changed

+92
-22
lines changed

google-beta/services/apigee/resource_apigee_organization_generated_test.go

Lines changed: 92 additions & 22 deletions
Original file line numberDiff line numberDiff line change
@@ -51,7 +51,6 @@ var (
5151
)
5252

5353
func TestAccApigeeOrganization_apigeeOrganizationCloudBasicTestExample(t *testing.T) {
54-
acctest.SkipIfVcr(t)
5554
t.Parallel()
5655

5756
context := map[string]interface{}{
@@ -150,11 +149,15 @@ resource "google_apigee_organization" "org" {
150149
google_project_service.apigee,
151150
]
152151
}
152+
153+
resource "time_sleep" "wait_after_destroy" {
154+
destroy_duration = "150s"
155+
depends_on = [google_apigee_organization.org]
156+
}
153157
`, context)
154158
}
155159

156160
func TestAccApigeeOrganization_apigeeOrganizationCloudBasicDisableVpcPeeringTestExample(t *testing.T) {
157-
acctest.SkipIfVcr(t)
158161
t.Parallel()
159162

160163
context := map[string]interface{}{
@@ -166,7 +169,10 @@ func TestAccApigeeOrganization_apigeeOrganizationCloudBasicDisableVpcPeeringTest
166169
acctest.VcrTest(t, resource.TestCase{
167170
PreCheck: func() { acctest.AccTestPreCheck(t) },
168171
ProtoV5ProviderFactories: acctest.ProtoV5ProviderFactories(t),
169-
CheckDestroy: testAccCheckApigeeOrganizationDestroyProducer(t),
172+
ExternalProviders: map[string]resource.ExternalProvider{
173+
"time": {},
174+
},
175+
CheckDestroy: testAccCheckApigeeOrganizationDestroyProducer(t),
170176
Steps: []resource.TestStep{
171177
{
172178
Config: testAccApigeeOrganization_apigeeOrganizationCloudBasicDisableVpcPeeringTestExample(context),
@@ -196,20 +202,30 @@ resource "google_project_service" "apigee" {
196202
service = "apigee.googleapis.com"
197203
}
198204
205+
resource "time_sleep" "wait_120_seconds" {
206+
create_duration = "120s"
207+
depends_on = [google_project_service.apigee]
208+
}
209+
210+
199211
resource "google_apigee_organization" "org" {
200212
description = "Terraform-provisioned basic Apigee Org without VPC Peering."
201213
analytics_region = "us-central1"
202214
project_id = google_project.project.project_id
203215
disable_vpc_peering = true
204216
depends_on = [
205-
google_project_service.apigee,
217+
time_sleep.wait_120_seconds,
206218
]
207219
}
220+
221+
resource "time_sleep" "wait_after_destroy" {
222+
destroy_duration = "150s"
223+
depends_on = [google_apigee_organization.org]
224+
}
208225
`, context)
209226
}
210227

211228
func TestAccApigeeOrganization_apigeeOrganizationCloudBasicDataResidencyTestExample(t *testing.T) {
212-
acctest.SkipIfVcr(t)
213229
t.Parallel()
214230

215231
context := map[string]interface{}{
@@ -221,7 +237,10 @@ func TestAccApigeeOrganization_apigeeOrganizationCloudBasicDataResidencyTestExam
221237
acctest.VcrTest(t, resource.TestCase{
222238
PreCheck: func() { acctest.AccTestPreCheck(t) },
223239
ProtoV5ProviderFactories: acctest.ProtoV5ProviderFactories(t),
224-
CheckDestroy: testAccCheckApigeeOrganizationDestroyProducer(t),
240+
ExternalProviders: map[string]resource.ExternalProvider{
241+
"time": {},
242+
},
243+
CheckDestroy: testAccCheckApigeeOrganizationDestroyProducer(t),
225244
Steps: []resource.TestStep{
226245
{
227246
Config: testAccApigeeOrganization_apigeeOrganizationCloudBasicDataResidencyTestExample(context),
@@ -255,21 +274,30 @@ resource "google_project_service" "apigee" {
255274
service = "apigee.googleapis.com"
256275
}
257276
277+
resource "time_sleep" "wait_120_seconds" {
278+
create_duration = "120s"
279+
depends_on = [google_project_service.apigee]
280+
}
281+
258282
resource "google_apigee_organization" "org" {
259283
description = "Terraform-provisioned basic Apigee Org under European Union hosting jurisdiction."
260284
project_id = google_project.project.project_id
261285
api_consumer_data_location = "europe-west1"
262286
billing_type = "PAYG"
263287
disable_vpc_peering = true
264288
depends_on = [
265-
google_project_service.apigee,
289+
time_sleep.wait_120_seconds,
266290
]
267291
}
292+
293+
resource "time_sleep" "wait_after_destroy" {
294+
destroy_duration = "150s"
295+
depends_on = [google_apigee_organization.org]
296+
}
268297
`, context)
269298
}
270299

271300
func TestAccApigeeOrganization_apigeeOrganizationCloudFullTestExample(t *testing.T) {
272-
acctest.SkipIfVcr(t)
273301
t.Parallel()
274302

275303
context := map[string]interface{}{
@@ -348,7 +376,7 @@ resource "google_project_service" "kms" {
348376
depends_on = [google_project_service.servicenetworking]
349377
}
350378
351-
resource "time_sleep" "wait_120_seconds" {
379+
resource "time_sleep" "wait_for_services" {
352380
create_duration = "120s"
353381
depends_on = [google_project_service.kms]
354382
}
@@ -358,7 +386,7 @@ resource "google_compute_network" "apigee_network" {
358386
359387
name = "apigee-network"
360388
project = google_project.project.project_id
361-
depends_on = [time_sleep.wait_120_seconds]
389+
depends_on = [time_sleep.wait_for_services]
362390
}
363391
364392
resource "google_compute_global_address" "apigee_range" {
@@ -413,6 +441,11 @@ resource "google_kms_crypto_key_iam_member" "apigee_sa_keyuser" {
413441
member = google_project_service_identity.apigee_sa.member
414442
}
415443
444+
resource "time_sleep" "wait_for_iam" {
445+
create_duration = "120s"
446+
depends_on = [google_kms_crypto_key_iam_member.apigee_sa_keyuser]
447+
}
448+
416449
resource "google_apigee_organization" "org" {
417450
provider = google-beta
418451
@@ -436,14 +469,18 @@ resource "google_apigee_organization" "org" {
436469
437470
depends_on = [
438471
google_service_networking_connection.apigee_vpc_connection,
439-
google_kms_crypto_key_iam_member.apigee_sa_keyuser,
472+
time_sleep.wait_for_iam,
440473
]
441474
}
475+
476+
resource "time_sleep" "wait_after_destroy" {
477+
destroy_duration = "150s"
478+
depends_on = [google_apigee_organization.org]
479+
}
442480
`, context)
443481
}
444482

445483
func TestAccApigeeOrganization_apigeeOrganizationCloudFullDisableVpcPeeringTestExample(t *testing.T) {
446-
acctest.SkipIfVcr(t)
447484
t.Parallel()
448485

449486
context := map[string]interface{}{
@@ -514,13 +551,18 @@ resource "google_project_service" "kms" {
514551
depends_on = [google_project_service.compute]
515552
}
516553
554+
resource "time_sleep" "wait_for_services" {
555+
create_duration = "120s"
556+
depends_on = [google_project_service.kms]
557+
}
558+
517559
resource "google_kms_key_ring" "apigee_keyring" {
518560
provider = google-beta
519561
520562
name = "apigee-keyring"
521563
location = "us-central1"
522564
project = google_project.project.project_id
523-
depends_on = [google_project_service.kms]
565+
depends_on = [time_sleep.wait_for_services]
524566
}
525567
526568
resource "google_kms_crypto_key" "apigee_key" {
@@ -546,6 +588,11 @@ resource "google_kms_crypto_key_iam_member" "apigee_sa_keyuser" {
546588
member = google_project_service_identity.apigee_sa.member
547589
}
548590
591+
resource "time_sleep" "wait_for_iam" {
592+
create_duration = "120s"
593+
depends_on = [google_kms_crypto_key_iam_member.apigee_sa_keyuser]
594+
}
595+
549596
resource "google_apigee_organization" "org" {
550597
provider = google-beta
551598
@@ -568,14 +615,18 @@ resource "google_apigee_organization" "org" {
568615
}
569616
570617
depends_on = [
571-
google_kms_crypto_key_iam_member.apigee_sa_keyuser,
618+
time_sleep.wait_for_iam,
572619
]
573620
}
621+
622+
resource "time_sleep" "wait_after_destroy" {
623+
destroy_duration = "150s"
624+
depends_on = [google_apigee_organization.org]
625+
}
574626
`, context)
575627
}
576628

577629
func TestAccApigeeOrganization_apigeeOrganizationRetentionTestExample(t *testing.T) {
578-
acctest.SkipIfVcr(t)
579630
t.Parallel()
580631

581632
context := map[string]interface{}{
@@ -654,7 +705,7 @@ resource "google_project_service" "kms" {
654705
depends_on = [google_project_service.servicenetworking]
655706
}
656707
657-
resource "time_sleep" "wait_120_seconds" {
708+
resource "time_sleep" "wait_for_services" {
658709
create_duration = "120s"
659710
depends_on = [google_project_service.kms]
660711
}
@@ -664,7 +715,7 @@ resource "google_compute_network" "apigee_network" {
664715
665716
name = "apigee-network"
666717
project = google_project.project.project_id
667-
depends_on = [time_sleep.wait_120_seconds]
718+
depends_on = [time_sleep.wait_for_services]
668719
}
669720
670721
resource "google_compute_global_address" "apigee_range" {
@@ -719,6 +770,11 @@ resource "google_kms_crypto_key_iam_member" "apigee_sa_keyuser" {
719770
member = google_project_service_identity.apigee_sa.member
720771
}
721772
773+
resource "time_sleep" "wait_for_iam" {
774+
create_duration = "120s"
775+
depends_on = [google_kms_crypto_key_iam_member.apigee_sa_keyuser]
776+
}
777+
722778
resource "google_apigee_organization" "org" {
723779
provider = google-beta
724780
@@ -732,14 +788,18 @@ resource "google_apigee_organization" "org" {
732788
depends_on = [
733789
google_service_networking_connection.apigee_vpc_connection,
734790
google_project_service.apigee,
735-
google_kms_crypto_key_iam_member.apigee_sa_keyuser,
791+
time_sleep.wait_for_iam,
736792
]
737793
}
794+
795+
resource "time_sleep" "wait_after_destroy" {
796+
destroy_duration = "150s"
797+
depends_on = [google_apigee_organization.org]
798+
}
738799
`, context)
739800
}
740801

741802
func TestAccApigeeOrganization_apigeeOrganizationDrzTestExample(t *testing.T) {
742-
acctest.SkipIfVcr(t)
743803
t.Parallel()
744804

745805
context := map[string]interface{}{
@@ -822,7 +882,7 @@ resource "google_project_service" "kms" {
822882
depends_on = [google_project_service.servicenetworking]
823883
}
824884
825-
resource "time_sleep" "wait_120_seconds" {
885+
resource "time_sleep" "wait_for_services" {
826886
create_duration = "120s"
827887
depends_on = [google_project_service.kms]
828888
}
@@ -832,7 +892,7 @@ resource "google_compute_network" "apigee_network" {
832892
833893
name = "apigee-network"
834894
project = google_project.project.project_id
835-
depends_on = [time_sleep.wait_120_seconds]
895+
depends_on = [time_sleep.wait_for_services]
836896
}
837897
838898
resource "google_compute_global_address" "apigee_range" {
@@ -887,6 +947,11 @@ resource "google_kms_crypto_key_iam_member" "apigee_sa_keyuser" {
887947
member = google_project_service_identity.apigee_sa.member
888948
}
889949
950+
resource "time_sleep" "wait_for_iam" {
951+
create_duration = "120s"
952+
depends_on = [google_kms_crypto_key_iam_member.apigee_sa_keyuser]
953+
}
954+
890955
resource "google_apigee_organization" "org" {
891956
provider = google-beta
892957
@@ -901,9 +966,14 @@ resource "google_apigee_organization" "org" {
901966
depends_on = [
902967
google_service_networking_connection.apigee_vpc_connection,
903968
google_project_service.apigee,
904-
google_kms_crypto_key_iam_member.apigee_sa_keyuser,
969+
time_sleep.wait_for_iam,
905970
]
906971
}
972+
973+
resource "time_sleep" "wait_after_destroy" {
974+
destroy_duration = "150s"
975+
depends_on = [google_apigee_organization.org]
976+
}
907977
`, context)
908978
}
909979

0 commit comments

Comments
 (0)