@@ -523,6 +523,64 @@ resource "kustomization_resource" "dep1" {
523
523
`
524
524
}
525
525
526
+ func TestAccResourceKustomization_add_wait (t * testing.T ) {
527
+ now := time .Now ()
528
+ resource .Test (t , resource.TestCase {
529
+ //PreCheck: func() { testAccPreCheck(t) },
530
+ Providers : testAccProviders ,
531
+ Steps : []resource.TestStep {
532
+ //
533
+ //
534
+ // Applying initial config with a svc and deployment in a namespace with no wait
535
+ {
536
+ Config : testAccResourceKustomizationConfig_wait_off ("test_kustomizations/wait-change/initial" ),
537
+ Check : resource .ComposeAggregateTestCheckFunc (
538
+ assertDurationIsShorterThan (now , 5 * time .Minute ),
539
+ testAccCheckManifestNestedString ("kustomization_resource.dep1" , "test" , "spec" , "selector" , "matchLabels" , "app" ),
540
+ ),
541
+ },
542
+ //
543
+ //
544
+ // Applying exactly the same configuration, but with wait turned on
545
+ {
546
+ Config : testAccResourceKustomizationConfig_wait_on ("test_kustomizations/wait-change/initial" ),
547
+ Check : resource .ComposeAggregateTestCheckFunc (
548
+ assertDurationIsShorterThan (now , 1 * time .Minute ),
549
+ testAccCheckManifestNestedString ("kustomization_resource.dep1" , "test" , "spec" , "selector" , "matchLabels" , "app" ),
550
+ testAccCheckDeploymentReady ("kustomization_resource.dep1" , "test-wait-change" , "test" ),
551
+ ),
552
+ },
553
+ },
554
+ })
555
+ }
556
+
557
+ func testAccResourceKustomizationConfig_wait_off (path string ) string {
558
+ return testAccDataSourceKustomizationConfig_basic (path ) + `
559
+ resource "kustomization_resource" "ns" {
560
+ manifest = data.kustomization_build.test.manifests["_/Namespace/_/test-wait-change"]
561
+ }
562
+ resource "kustomization_resource" "dep1" {
563
+ manifest = data.kustomization_build.test.manifests["apps/Deployment/test-wait-change/test"]
564
+ }
565
+ `
566
+ }
567
+
568
+ func testAccResourceKustomizationConfig_wait_on (path string ) string {
569
+ return testAccDataSourceKustomizationConfig_basic (path ) + `
570
+ resource "kustomization_resource" "ns" {
571
+ manifest = data.kustomization_build.test.manifests["_/Namespace/_/test-wait-change"]
572
+ }
573
+ resource "kustomization_resource" "dep1" {
574
+ manifest = data.kustomization_build.test.manifests["apps/Deployment/test-wait-change/test"]
575
+ wait = true
576
+ timeouts {
577
+ create = "1m"
578
+ update = "1m"
579
+ }
580
+ }
581
+ `
582
+ }
583
+
526
584
func TestAccResourceKustomization_wait_failure (t * testing.T ) {
527
585
now := time .Now ()
528
586
0 commit comments