Skip to content

Commit

Permalink
Fix Failing test TestAccSecurityCenterManagement Folder SHA Custom Mo…
Browse files Browse the repository at this point in the history
…dule (#12462)
  • Loading branch information
vijaykanthm authored Dec 2, 2024
1 parent 311ba2f commit 6b0b4cc
Showing 1 changed file with 22 additions and 6 deletions.
Original file line number Diff line number Diff line change
Expand Up @@ -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) {

Expand All @@ -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),
Expand Down Expand Up @@ -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" {
Expand All @@ -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)
}
Expand All @@ -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
Expand Down Expand Up @@ -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)
}
Expand All @@ -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
Expand Down Expand Up @@ -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)
}
Expand Down

0 comments on commit 6b0b4cc

Please sign in to comment.