Skip to content

Commit 2015e36

Browse files
Fix test TestAccSecurityCenterManagementOrganizationEventThreatDetectionCustomModule (#11469) (#8009)
[upstream:bc5def9f8136003836911e78567dc8849a39be6d] Signed-off-by: Modular Magician <[email protected]>
1 parent 0f3024e commit 2015e36

5 files changed

+28
-8
lines changed

.changelog/11469.txt

Lines changed: 3 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,3 @@
1+
```release-note:none
2+
fixed tests for `google_scc_management_organization_event_threat_detection_custom_module` resource
3+
```

google-beta/services/securitycentermanagement/resource_scc_management_folder_security_health_analytics_custom_module_test.go

Lines changed: 1 addition & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -18,8 +18,7 @@ import (
1818

1919
// Custom Module tests cannot be run in parallel without running into 409 Conflict reponses.
2020
// Run them as individual steps of an update test instead.
21-
func TestAccSecurityCenterManagementFolderSecurityHealthAnalyticsCustomModule(t *testing.T) {
22-
t.Parallel()
21+
func testAccSecurityCenterManagementFolderSecurityHealthAnalyticsCustomModule(t *testing.T) {
2322

2423
context := map[string]interface{}{
2524
"org_id": envvar.GetTestOrgFromEnv(t),

google-beta/services/securitycentermanagement/resource_scc_management_organization_event_threat_detection_custom_module_test.go

Lines changed: 22 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -16,8 +16,28 @@ import (
1616
transport_tpg "github.com/hashicorp/terraform-provider-google-beta/google-beta/transport"
1717
)
1818

19-
func TestAccSecurityCenterManagementOrganizationEventThreatDetectionCustomModule(t *testing.T) {
20-
t.Parallel()
19+
func TestAccSecurityCenterManagement(t *testing.T) {
20+
testCases := map[string]func(t *testing.T){
21+
"orgSecurity": testAccSecurityCenterManagementOrganizationSecurityHealthAnalyticsCustomModule,
22+
"folderSecurity": testAccSecurityCenterManagementFolderSecurityHealthAnalyticsCustomModule,
23+
"projectSecurity": testAccSecurityCenterManagementProjectSecurityHealthAnalyticsCustomModule,
24+
"organization": testAccSecurityCenterManagementOrganizationEventThreatDetectionCustomModule,
25+
}
26+
27+
for name, tc := range testCases {
28+
// shadow the tc variable into scope so that when
29+
// the loop continues, if t.Run hasn't executed tc(t)
30+
// yet, we don't have a race condition
31+
// see https://github.com/golang/go/wiki/CommonMistakes#using-goroutines-on-loop-iterator-variables
32+
tc := tc
33+
t.Run(name, func(t *testing.T) {
34+
tc(t)
35+
})
36+
}
37+
}
38+
39+
func testAccSecurityCenterManagementOrganizationEventThreatDetectionCustomModule(t *testing.T) {
40+
// t.Parallel()
2141

2242
context := map[string]interface{}{
2343
"org_id": envvar.GetTestOrgFromEnv(t),

google-beta/services/securitycentermanagement/resource_scc_management_organization_project_security_health_analytics_custom_module_test.go

Lines changed: 1 addition & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -17,8 +17,7 @@ import (
1717

1818
// Custom Module tests cannot be run in parallel without running into 409 Conflict reponses.
1919
// Run them as individual steps of an update test instead.
20-
func TestAccSecurityCenterManagementProjectSecurityHealthAnalyticsCustomModule(t *testing.T) {
21-
t.Parallel()
20+
func testAccSecurityCenterManagementProjectSecurityHealthAnalyticsCustomModule(t *testing.T) {
2221

2322
context := map[string]interface{}{
2423
"random_suffix": acctest.RandString(t, 10),

google-beta/services/securitycentermanagement/resource_scc_management_organization_security_health_analytics_custom_module_test.go

Lines changed: 1 addition & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -18,8 +18,7 @@ import (
1818

1919
// Custom Module tests cannot be run in parallel without running into 409 Conflict reponses.
2020
// Run them as individual steps of an update test instead.
21-
func TestAccSecurityCenterManagementOrganizationSecurityHealthAnalyticsCustomModule(t *testing.T) {
22-
t.Parallel()
21+
func testAccSecurityCenterManagementOrganizationSecurityHealthAnalyticsCustomModule(t *testing.T) {
2322

2423
context := map[string]interface{}{
2524
"org_id": envvar.GetTestOrgFromEnv(t),

0 commit comments

Comments
 (0)