@@ -125,20 +125,21 @@ func testAccAdvancedClusterFlexUpgrade(t *testing.T, instanceSize string, includ
125
125
projectID , clusterName := acc .ProjectIDExecutionWithCluster (t , 1 )
126
126
defaultZoneName := "Zone 1" // Uses backend default as in existing tests
127
127
128
+ // avoid checking plural data source to reduce risk of being impacted from failure in other test using same project, allows running in parallel
128
129
steps := []resource.TestStep {
129
130
{
130
131
Config : configTenant (t , true , projectID , clusterName , defaultZoneName , instanceSize ),
131
- Check : checkTenant (true , projectID , clusterName ),
132
+ Check : checkTenant (true , projectID , clusterName , false ),
132
133
},
133
134
{
134
135
Config : configFlexCluster (t , projectID , clusterName , "AWS" , "US_EAST_1" , defaultZoneName , "" , false , nil ),
135
- Check : checkFlexClusterConfig (projectID , clusterName , "AWS" , "US_EAST_1" , false ),
136
+ Check : checkFlexClusterConfig (projectID , clusterName , "AWS" , "US_EAST_1" , false , false ),
136
137
},
137
138
}
138
139
if includeDedicated {
139
140
steps = append (steps , resource.TestStep {
140
141
Config : acc .ConvertAdvancedClusterToPreviewProviderV2 (t , true , acc .ConfigBasicDedicated (projectID , clusterName , defaultZoneName )),
141
- Check : checksBasicDedicated (projectID , clusterName ),
142
+ Check : checksBasicDedicated (projectID , clusterName , false ),
142
143
})
143
144
}
144
145
@@ -151,11 +152,11 @@ func testAccAdvancedClusterFlexUpgrade(t *testing.T, instanceSize string, includ
151
152
}
152
153
153
154
func TestAccAdvancedCluster_basicTenant_flexUpgrade_dedicatedUpgrade (t * testing.T ) {
154
- resource .Test (t , testAccAdvancedClusterFlexUpgrade (t , freeInstanceSize , true ))
155
+ resource .ParallelTest (t , testAccAdvancedClusterFlexUpgrade (t , freeInstanceSize , true ))
155
156
}
156
157
157
158
func TestAccAdvancedCluster_sharedTier_flexUpgrade (t * testing.T ) {
158
- resource .Test (t , testAccAdvancedClusterFlexUpgrade (t , sharedInstanceSize , false ))
159
+ resource .ParallelTest (t , testAccAdvancedClusterFlexUpgrade (t , sharedInstanceSize , false ))
159
160
}
160
161
func TestAccMockableAdvancedCluster_tenantUpgrade (t * testing.T ) {
161
162
var (
@@ -169,11 +170,11 @@ func TestAccMockableAdvancedCluster_tenantUpgrade(t *testing.T) {
169
170
Steps : []resource.TestStep {
170
171
{
171
172
Config : acc .ConvertAdvancedClusterToPreviewProviderV2 (t , true , configTenant (t , true , projectID , clusterName , defaultZoneName , freeInstanceSize )),
172
- Check : checkTenant (true , projectID , clusterName ),
173
+ Check : checkTenant (true , projectID , clusterName , true ),
173
174
},
174
175
{
175
176
Config : acc .ConvertAdvancedClusterToPreviewProviderV2 (t , true , acc .ConfigBasicDedicated (projectID , clusterName , defaultZoneName )),
176
- Check : checksBasicDedicated (projectID , clusterName ),
177
+ Check : checksBasicDedicated (projectID , clusterName , true ),
177
178
},
178
179
acc .TestStepImportCluster (resourceName ),
179
180
},
@@ -1732,9 +1733,12 @@ func configTenant(t *testing.T, usePreviewProvider bool, projectID, name, zoneNa
1732
1733
` , projectID , name , zoneNameLine , instanceSize )) + dataSourcesTFNewSchema
1733
1734
}
1734
1735
1735
- func checkTenant (usePreviewProvider bool , projectID , name string ) resource.TestCheckFunc {
1736
- pluralChecks := acc .AddAttrSetChecksPreviewProviderV2 (usePreviewProvider , dataSourcePluralName , nil ,
1737
- []string {"results.#" , "results.0.replication_specs.#" , "results.0.name" , "results.0.termination_protection_enabled" , "results.0.global_cluster_self_managed_sharding" }... )
1736
+ func checkTenant (usePreviewProvider bool , projectID , name string , checkPlural bool ) resource.TestCheckFunc {
1737
+ var pluralChecks []resource.TestCheckFunc
1738
+ if checkPlural {
1739
+ pluralChecks = acc .AddAttrSetChecksPreviewProviderV2 (usePreviewProvider , dataSourcePluralName , nil ,
1740
+ []string {"results.#" , "results.0.replication_specs.#" , "results.0.name" , "results.0.termination_protection_enabled" , "results.0.global_cluster_self_managed_sharding" }... )
1741
+ }
1738
1742
return checkAggr (usePreviewProvider ,
1739
1743
[]string {"replication_specs.#" , "replication_specs.0.id" , "replication_specs.0.region_configs.#" },
1740
1744
map [string ]string {
@@ -1745,8 +1749,8 @@ func checkTenant(usePreviewProvider bool, projectID, name string) resource.TestC
1745
1749
pluralChecks ... )
1746
1750
}
1747
1751
1748
- func checksBasicDedicated (projectID , name string ) resource.TestCheckFunc {
1749
- originalChecks := checkTenant (true , projectID , name )
1752
+ func checksBasicDedicated (projectID , name string , checkPlural bool ) resource.TestCheckFunc {
1753
+ originalChecks := checkTenant (true , projectID , name , checkPlural )
1750
1754
checkMap := map [string ]string {
1751
1755
"replication_specs.0.region_configs.0.electable_specs.0.node_count" : "3" ,
1752
1756
"replication_specs.0.region_configs.0.electable_specs.0.instance_size" : "M10" ,
@@ -3254,11 +3258,11 @@ func TestAccClusterFlexCluster_basic(t *testing.T) {
3254
3258
Steps : []resource.TestStep {
3255
3259
{
3256
3260
Config : configFlexCluster (t , projectID , clusterName , "AWS" , "US_EAST_1" , "" , emptyTimeoutConfig , false , nil ),
3257
- Check : checkFlexClusterConfig (projectID , clusterName , "AWS" , "US_EAST_1" , false ),
3261
+ Check : checkFlexClusterConfig (projectID , clusterName , "AWS" , "US_EAST_1" , false , true ),
3258
3262
},
3259
3263
{
3260
3264
Config : configFlexCluster (t , projectID , clusterName , "AWS" , "US_EAST_1" , "" , emptyTimeoutConfig , true , nil ),
3261
- Check : checkFlexClusterConfig (projectID , clusterName , "AWS" , "US_EAST_1" , true ),
3265
+ Check : checkFlexClusterConfig (projectID , clusterName , "AWS" , "US_EAST_1" , true , true ),
3262
3266
},
3263
3267
acc .TestStepImportCluster (resourceName ),
3264
3268
{
@@ -3319,7 +3323,7 @@ func TestAccAdvancedCluster_updateDeleteTimeoutFlex(t *testing.T) {
3319
3323
})
3320
3324
}
3321
3325
3322
- func checkFlexClusterConfig (projectID , clusterName , providerName , region string , tagsCheck bool ) resource.TestCheckFunc {
3326
+ func checkFlexClusterConfig (projectID , clusterName , providerName , region string , tagsCheck , checkPlural bool ) resource.TestCheckFunc {
3323
3327
checks := []resource.TestCheckFunc {acc .CheckExistsFlexCluster ()}
3324
3328
attrMapAdvCluster := map [string ]string {
3325
3329
"name" : clusterName ,
@@ -3362,17 +3366,22 @@ func checkFlexClusterConfig(projectID, clusterName, providerName, region string,
3362
3366
tagsCheck := checkKeyValueBlocks (true , true , "tags" , tagsMap )
3363
3367
checks = append (checks , tagsCheck )
3364
3368
}
3365
- pluralMap := map [string ]string {
3366
- "project_id" : projectID ,
3367
- "results.#" : "1" ,
3368
- }
3369
3369
checks = acc .AddAttrChecks (acc .FlexDataSourceName , checks , attrMapFlex )
3370
3370
checks = acc .AddAttrSetChecks (acc .FlexDataSourceName , checks , attrSetFlex ... )
3371
- checks = acc .AddAttrChecks (acc .FlexDataSourcePluralName , checks , pluralMap )
3372
- checks = acc .AddAttrChecksPrefix (acc .FlexDataSourcePluralName , checks , attrMapFlex , "results.0" )
3373
- checks = acc .AddAttrSetChecksPrefix (acc .FlexDataSourcePluralName , checks , attrSetFlex , "results.0" )
3374
- checks = acc .AddAttrChecks (dataSourcePluralName , checks , pluralMap )
3375
3371
ds := conversion .StringPtr (dataSourceName )
3376
- dsp := conversion .StringPtr (dataSourcePluralName )
3372
+ var dsp * string
3373
+
3374
+ if checkPlural {
3375
+ dsp = conversion .StringPtr (dataSourcePluralName )
3376
+
3377
+ pluralMap := map [string ]string {
3378
+ "project_id" : projectID ,
3379
+ "results.#" : "1" ,
3380
+ }
3381
+ checks = acc .AddAttrChecks (acc .FlexDataSourcePluralName , checks , pluralMap )
3382
+ checks = acc .AddAttrChecksPrefix (acc .FlexDataSourcePluralName , checks , attrMapFlex , "results.0" )
3383
+ checks = acc .AddAttrSetChecksPrefix (acc .FlexDataSourcePluralName , checks , attrSetFlex , "results.0" )
3384
+ checks = acc .AddAttrChecks (dataSourcePluralName , checks , pluralMap )
3385
+ }
3377
3386
return acc .CheckRSAndDSPreviewProviderV2 (true , resourceName , ds , dsp , attrSetAdvCluster , attrMapAdvCluster , checks ... )
3378
3387
}
0 commit comments