diff --git a/.changelog/11469.txt b/.changelog/11469.txt new file mode 100644 index 00000000000..2ddbc19eec9 --- /dev/null +++ b/.changelog/11469.txt @@ -0,0 +1,3 @@ +```release-note:none +fixed tests for `google_scc_management_organization_event_threat_detection_custom_module` resource +``` \ No newline at end of file diff --git a/google/services/securitycentermanagement/resource_scc_management_folder_security_health_analytics_custom_module_test.go b/google/services/securitycentermanagement/resource_scc_management_folder_security_health_analytics_custom_module_test.go index 2c76ab24f9b..40edcec87f9 100644 --- a/google/services/securitycentermanagement/resource_scc_management_folder_security_health_analytics_custom_module_test.go +++ b/google/services/securitycentermanagement/resource_scc_management_folder_security_health_analytics_custom_module_test.go @@ -18,8 +18,7 @@ import ( // Custom Module tests cannot be run in parallel without running into 409 Conflict reponses. // Run them as individual steps of an update test instead. -func TestAccSecurityCenterManagementFolderSecurityHealthAnalyticsCustomModule(t *testing.T) { - t.Parallel() +func testAccSecurityCenterManagementFolderSecurityHealthAnalyticsCustomModule(t *testing.T) { context := map[string]interface{}{ "org_id": envvar.GetTestOrgFromEnv(t), diff --git a/google/services/securitycentermanagement/resource_scc_management_organization_event_threat_detection_custom_module_test.go b/google/services/securitycentermanagement/resource_scc_management_organization_event_threat_detection_custom_module_test.go index f31b5638f11..65b9d9371a5 100644 --- a/google/services/securitycentermanagement/resource_scc_management_organization_event_threat_detection_custom_module_test.go +++ b/google/services/securitycentermanagement/resource_scc_management_organization_event_threat_detection_custom_module_test.go @@ -16,8 +16,28 @@ import ( transport_tpg "github.com/hashicorp/terraform-provider-google/google/transport" ) -func TestAccSecurityCenterManagementOrganizationEventThreatDetectionCustomModule(t *testing.T) { - t.Parallel() +func TestAccSecurityCenterManagement(t *testing.T) { + testCases := map[string]func(t *testing.T){ + "orgSecurity": testAccSecurityCenterManagementOrganizationSecurityHealthAnalyticsCustomModule, + "folderSecurity": testAccSecurityCenterManagementFolderSecurityHealthAnalyticsCustomModule, + "projectSecurity": testAccSecurityCenterManagementProjectSecurityHealthAnalyticsCustomModule, + "organization": testAccSecurityCenterManagementOrganizationEventThreatDetectionCustomModule, + } + + for name, tc := range testCases { + // shadow the tc variable into scope so that when + // the loop continues, if t.Run hasn't executed tc(t) + // yet, we don't have a race condition + // see https://github.com/golang/go/wiki/CommonMistakes#using-goroutines-on-loop-iterator-variables + tc := tc + t.Run(name, func(t *testing.T) { + tc(t) + }) + } +} + +func testAccSecurityCenterManagementOrganizationEventThreatDetectionCustomModule(t *testing.T) { + // t.Parallel() context := map[string]interface{}{ "org_id": envvar.GetTestOrgFromEnv(t), diff --git a/google/services/securitycentermanagement/resource_scc_management_organization_project_security_health_analytics_custom_module_test.go b/google/services/securitycentermanagement/resource_scc_management_organization_project_security_health_analytics_custom_module_test.go index 98d156bbd6d..54bc5135d0f 100644 --- a/google/services/securitycentermanagement/resource_scc_management_organization_project_security_health_analytics_custom_module_test.go +++ b/google/services/securitycentermanagement/resource_scc_management_organization_project_security_health_analytics_custom_module_test.go @@ -17,8 +17,7 @@ import ( // Custom Module tests cannot be run in parallel without running into 409 Conflict reponses. // Run them as individual steps of an update test instead. -func TestAccSecurityCenterManagementProjectSecurityHealthAnalyticsCustomModule(t *testing.T) { - t.Parallel() +func testAccSecurityCenterManagementProjectSecurityHealthAnalyticsCustomModule(t *testing.T) { context := map[string]interface{}{ "random_suffix": acctest.RandString(t, 10), diff --git a/google/services/securitycentermanagement/resource_scc_management_organization_security_health_analytics_custom_module_test.go b/google/services/securitycentermanagement/resource_scc_management_organization_security_health_analytics_custom_module_test.go index 607999b19ba..c74ac4d04d2 100644 --- a/google/services/securitycentermanagement/resource_scc_management_organization_security_health_analytics_custom_module_test.go +++ b/google/services/securitycentermanagement/resource_scc_management_organization_security_health_analytics_custom_module_test.go @@ -18,8 +18,7 @@ import ( // Custom Module tests cannot be run in parallel without running into 409 Conflict reponses. // Run them as individual steps of an update test instead. -func TestAccSecurityCenterManagementOrganizationSecurityHealthAnalyticsCustomModule(t *testing.T) { - t.Parallel() +func testAccSecurityCenterManagementOrganizationSecurityHealthAnalyticsCustomModule(t *testing.T) { context := map[string]interface{}{ "org_id": envvar.GetTestOrgFromEnv(t),