From 6b0b4ccb126cbc2eb389c92f12f0d6d2776b28f1 Mon Sep 17 00:00:00 2001 From: vijaykanthm Date: Mon, 2 Dec 2024 09:28:11 -0800 Subject: [PATCH] Fix Failing test TestAccSecurityCenterManagement Folder SHA Custom Module (#12462) --- ...ealth_analytics_custom_module_test.go.tmpl | 28 +++++++++++++++---- 1 file changed, 22 insertions(+), 6 deletions(-) diff --git a/mmv1/third_party/terraform/services/securitycentermanagement/resource_scc_management_folder_security_health_analytics_custom_module_test.go.tmpl b/mmv1/third_party/terraform/services/securitycentermanagement/resource_scc_management_folder_security_health_analytics_custom_module_test.go.tmpl index d8b6433da018..6c357dbc8fe0 100644 --- a/mmv1/third_party/terraform/services/securitycentermanagement/resource_scc_management_folder_security_health_analytics_custom_module_test.go.tmpl +++ b/mmv1/third_party/terraform/services/securitycentermanagement/resource_scc_management_folder_security_health_analytics_custom_module_test.go.tmpl @@ -15,7 +15,7 @@ import ( transport_tpg "github.com/hashicorp/terraform-provider-google/google/transport" ) -// Custom Module tests cannot be run in parallel without running into 409 Conflict reponses. +// Custom Module tests cannot be run in parallel without running into 409 Conflict responses. // Run them as individual steps of an update test instead. func testAccSecurityCenterManagementFolderSecurityHealthAnalyticsCustomModule(t *testing.T) { @@ -26,6 +26,9 @@ func testAccSecurityCenterManagementFolderSecurityHealthAnalyticsCustomModule(t "random_suffix": acctest.RandString(t, 10), } + // Log the organization ID for debugging purposes + t.Logf("Using Organization ID: %s", context["org_id"]) + acctest.VcrTest(t, resource.TestCase{ PreCheck: func() { acctest.AccTestPreCheck(t) }, ProtoV5ProviderFactories: acctest.ProtoV5ProviderBetaFactories(t), @@ -75,10 +78,9 @@ resource "google_folder" "folder" { deletion_protection = false } -resource "time_sleep" "wait_1_minute" { +resource "time_sleep" "wait_5_minute" { depends_on = [google_folder.folder] - - create_duration = "2m" + create_duration = "5m" } resource "google_scc_management_folder_security_health_analytics_custom_module" "example" { @@ -101,8 +103,7 @@ resource "google_scc_management_folder_security_health_analytics_custom_module" severity = "MEDIUM" } - - depends_on = [time_sleep.wait_1_minute] + depends_on = [time_sleep.wait_5_minute] } `, context) } @@ -116,6 +117,11 @@ resource "google_folder" "folder" { deletion_protection = false } +resource "time_sleep" "wait_5_minute" { + depends_on = [google_folder.folder] + create_duration = "5m" +} + resource "google_scc_management_folder_security_health_analytics_custom_module" "example" { provider = google-beta folder = google_folder.folder.folder_id @@ -149,6 +155,8 @@ resource "google_scc_management_folder_security_health_analytics_custom_module" description = "Description of the custom module" recommendation = "Steps to resolve violation" } + + depends_on = [time_sleep.wait_5_minute] } `, context) } @@ -162,6 +170,11 @@ resource "google_folder" "folder" { deletion_protection = false } +resource "time_sleep" "wait_3_minute" { + depends_on = [google_folder.folder] + create_duration = "3m" +} + resource "google_scc_management_folder_security_health_analytics_custom_module" "example" { provider = google-beta folder = google_folder.folder.folder_id @@ -195,6 +208,9 @@ resource "google_scc_management_folder_security_health_analytics_custom_module" description = "Updated description of the custom module" recommendation = "Updated steps to resolve violation" } + + depends_on = [time_sleep.wait_3_minute] + } `, context) }