diff --git a/GNUmakefile b/GNUmakefile index afdda4f647..db9e464ac1 100644 --- a/GNUmakefile +++ b/GNUmakefile @@ -8,7 +8,7 @@ endif ACCTEST_REGEX_RUN?=^TestAcc ACCTEST_TIMEOUT?=300m -PARALLEL_GO_TEST?=20 +PARALLEL_GO_TEST?=50 BINARY_NAME=terraform-provider-mongodbatlas DESTINATION=./bin/$(BINARY_NAME) diff --git a/internal/service/advancedcluster/resource_advanced_cluster_migration_test.go b/internal/service/advancedcluster/resource_advanced_cluster_migration_test.go index 77e15b3c4c..ad47313150 100644 --- a/internal/service/advancedcluster/resource_advanced_cluster_migration_test.go +++ b/internal/service/advancedcluster/resource_advanced_cluster_migration_test.go @@ -47,7 +47,7 @@ func TestMigAdvancedCluster_replicaSetAWSProviderUpdate(t *testing.T) { ) resource.ParallelTest(t, resource.TestCase{ - PreCheck: func() { mig.PreCheckBasic(t) }, + PreCheck: mig.PreCheckBasicSleep(t), CheckDestroy: acc.CheckDestroyCluster, Steps: []resource.TestStep{ { @@ -192,7 +192,7 @@ func TestMigAdvancedCluster_partialAdvancedConf(t *testing.T) { ) resource.ParallelTest(t, resource.TestCase{ - PreCheck: func() { acc.PreCheckBasic(t) }, + PreCheck: mig.PreCheckBasicSleep(t), CheckDestroy: acc.CheckDestroyCluster, Steps: []resource.TestStep{ { diff --git a/internal/service/advancedcluster/resource_advanced_cluster_test.go b/internal/service/advancedcluster/resource_advanced_cluster_test.go index 196bc87090..0be73c1911 100644 --- a/internal/service/advancedcluster/resource_advanced_cluster_test.go +++ b/internal/service/advancedcluster/resource_advanced_cluster_test.go @@ -31,7 +31,7 @@ func TestAccClusterAdvancedCluster_basicTenant(t *testing.T) { clusterNameUpdated = acc.RandomClusterName() ) resource.ParallelTest(t, resource.TestCase{ - PreCheck: func() { acc.PreCheckBasic(t) }, + PreCheck: acc.PreCheckBasicSleep(t), ProtoV6ProviderFactories: acc.TestAccProviderV6Factories, CheckDestroy: acc.CheckDestroyCluster, Steps: []resource.TestStep{ @@ -64,7 +64,7 @@ func replicaSetAWSProviderTestCase(t *testing.T) resource.TestCase { ) return resource.TestCase{ - PreCheck: func() { acc.PreCheckBasic(t) }, + PreCheck: acc.PreCheckBasicSleep(t), ProtoV6ProviderFactories: acc.TestAccProviderV6Factories, CheckDestroy: acc.CheckDestroyCluster, Steps: []resource.TestStep{ @@ -169,7 +169,7 @@ func TestAccClusterAdvancedCluster_unpausedToPaused(t *testing.T) { ) resource.ParallelTest(t, resource.TestCase{ - PreCheck: func() { acc.PreCheckBasic(t) }, + PreCheck: acc.PreCheckBasicSleep(t), ProtoV6ProviderFactories: acc.TestAccProviderV6Factories, CheckDestroy: acc.CheckDestroyCluster, Steps: []resource.TestStep{ @@ -204,7 +204,7 @@ func TestAccClusterAdvancedCluster_pausedToUnpaused(t *testing.T) { ) resource.ParallelTest(t, resource.TestCase{ - PreCheck: func() { acc.PreCheckBasic(t) }, + PreCheck: acc.PreCheckBasicSleep(t), ProtoV6ProviderFactories: acc.TestAccProviderV6Factories, CheckDestroy: acc.CheckDestroyCluster, Steps: []resource.TestStep{ @@ -266,7 +266,7 @@ func TestAccClusterAdvancedCluster_advancedConfig(t *testing.T) { ) resource.ParallelTest(t, resource.TestCase{ - PreCheck: func() { acc.PreCheckBasic(t) }, + PreCheck: acc.PreCheckBasicSleep(t), ProtoV6ProviderFactories: acc.TestAccProviderV6Factories, CheckDestroy: acc.CheckDestroyCluster, Steps: []resource.TestStep{ @@ -301,7 +301,7 @@ func TestAccClusterAdvancedCluster_advancedConfig_MongoDBVersion5(t *testing.T) ) resource.ParallelTest(t, resource.TestCase{ - PreCheck: func() { acc.PreCheckBasic(t) }, + PreCheck: acc.PreCheckBasicSleep(t), ProtoV6ProviderFactories: acc.TestAccProviderV6Factories, CheckDestroy: acc.CheckDestroyCluster, Steps: []resource.TestStep{ @@ -342,7 +342,7 @@ func TestAccClusterAdvancedCluster_defaultWrite(t *testing.T) { ) resource.ParallelTest(t, resource.TestCase{ - PreCheck: func() { acc.PreCheckBasic(t) }, + PreCheck: acc.PreCheckBasicSleep(t), ProtoV6ProviderFactories: acc.TestAccProviderV6Factories, CheckDestroy: acc.CheckDestroyCluster, Steps: []resource.TestStep{ @@ -374,7 +374,7 @@ func TestAccClusterAdvancedClusterConfig_replicationSpecsAutoScaling(t *testing. ) resource.ParallelTest(t, resource.TestCase{ - PreCheck: func() { acc.PreCheckBasic(t) }, + PreCheck: acc.PreCheckBasicSleep(t), ProtoV6ProviderFactories: acc.TestAccProviderV6Factories, CheckDestroy: acc.CheckDestroyCluster, Steps: []resource.TestStep{ @@ -417,7 +417,7 @@ func TestAccClusterAdvancedClusterConfig_replicationSpecsAnalyticsAutoScaling(t ) resource.ParallelTest(t, resource.TestCase{ - PreCheck: func() { acc.PreCheckBasic(t) }, + PreCheck: acc.PreCheckBasicSleep(t), ProtoV6ProviderFactories: acc.TestAccProviderV6Factories, CheckDestroy: acc.CheckDestroyCluster, Steps: []resource.TestStep{ @@ -530,7 +530,7 @@ func TestAccClusterAdvancedClusterConfig_selfManagedShardingIncorrectType(t *tes ) resource.ParallelTest(t, resource.TestCase{ - PreCheck: func() { acc.PreCheckBasic(t) }, + PreCheck: acc.PreCheckBasicSleep(t), ProtoV6ProviderFactories: acc.TestAccProviderV6Factories, CheckDestroy: acc.CheckDestroyCluster, Steps: []resource.TestStep{ diff --git a/internal/service/cloudbackupschedule/resource_cloud_backup_schedule_migration_test.go b/internal/service/cloudbackupschedule/resource_cloud_backup_schedule_migration_test.go index 8ce9343db3..d5cef4cb6f 100644 --- a/internal/service/cloudbackupschedule/resource_cloud_backup_schedule_migration_test.go +++ b/internal/service/cloudbackupschedule/resource_cloud_backup_schedule_migration_test.go @@ -22,7 +22,7 @@ func TestMigBackupRSCloudBackupSchedule_basic(t *testing.T) { ) resource.ParallelTest(t, resource.TestCase{ - PreCheck: func() { mig.PreCheckBasic(t) }, + PreCheck: mig.PreCheckBasicSleep(t), CheckDestroy: checkDestroy, Steps: []resource.TestStep{ { @@ -109,7 +109,7 @@ func TestMigBackupRSCloudBackupSchedule_copySettings(t *testing.T) { checksUpdateWithZoneID := acc.AddAttrSetChecks(resourceName, checksCreate, "copy_settings.0.zone_id") resource.ParallelTest(t, resource.TestCase{ - PreCheck: func() { acc.PreCheckBasic(t) }, + PreCheck: mig.PreCheckBasicSleep(t), CheckDestroy: checkDestroy, Steps: []resource.TestStep{ { diff --git a/internal/service/cloudbackupschedule/resource_cloud_backup_schedule_test.go b/internal/service/cloudbackupschedule/resource_cloud_backup_schedule_test.go index a39c810386..4e5930aef6 100644 --- a/internal/service/cloudbackupschedule/resource_cloud_backup_schedule_test.go +++ b/internal/service/cloudbackupschedule/resource_cloud_backup_schedule_test.go @@ -25,7 +25,7 @@ func TestAccBackupRSCloudBackupSchedule_basic(t *testing.T) { ) resource.ParallelTest(t, resource.TestCase{ - PreCheck: func() { acc.PreCheckBasic(t) }, + PreCheck: acc.PreCheckBasicSleep(t), ProtoV6ProviderFactories: acc.TestAccProviderV6Factories, CheckDestroy: checkDestroy, Steps: []resource.TestStep{ @@ -159,7 +159,7 @@ func TestAccBackupRSCloudBackupSchedule_export(t *testing.T) { ) resource.ParallelTest(t, resource.TestCase{ - PreCheck: func() { acc.PreCheckBasic(t) }, + PreCheck: acc.PreCheckBasicSleep(t), ExternalProviders: acc.ExternalProvidersOnlyAWS(), ProtoV6ProviderFactories: acc.TestAccProviderV6Factories, @@ -188,7 +188,7 @@ func TestAccBackupRSCloudBackupSchedule_onePolicy(t *testing.T) { ) resource.ParallelTest(t, resource.TestCase{ - PreCheck: func() { acc.PreCheckBasic(t) }, + PreCheck: acc.PreCheckBasicSleep(t), ProtoV6ProviderFactories: acc.TestAccProviderV6Factories, CheckDestroy: checkDestroy, Steps: []resource.TestStep{ @@ -313,7 +313,7 @@ func TestAccBackupRSCloudBackupSchedule_copySettings_repSpecId(t *testing.T) { checksUpdate := acc.AddAttrChecks(resourceName, checksDefaultRS, emptyCopySettingsChecks) resource.ParallelTest(t, resource.TestCase{ - PreCheck: func() { acc.PreCheckBasic(t) }, + PreCheck: acc.PreCheckBasicSleep(t), ProtoV6ProviderFactories: acc.TestAccProviderV6Factories, CheckDestroy: checkDestroy, Steps: []resource.TestStep{ @@ -399,7 +399,7 @@ func TestAccBackupRSCloudBackupSchedule_copySettings_zoneId(t *testing.T) { checksUpdate := acc.AddAttrChecks(resourceName, checksDefaultRS, emptyCopySettingsChecks) resource.ParallelTest(t, resource.TestCase{ - PreCheck: func() { acc.PreCheckBasic(t) }, + PreCheck: acc.PreCheckBasicSleep(t), ProtoV6ProviderFactories: acc.TestAccProviderV6Factories, CheckDestroy: checkDestroy, Steps: []resource.TestStep{ @@ -429,7 +429,7 @@ func TestAccBackupRSCloudBackupScheduleImport_basic(t *testing.T) { ) resource.ParallelTest(t, resource.TestCase{ - PreCheck: func() { acc.PreCheckBasic(t) }, + PreCheck: acc.PreCheckBasicSleep(t), ProtoV6ProviderFactories: acc.TestAccProviderV6Factories, CheckDestroy: checkDestroy, Steps: []resource.TestStep{ @@ -484,7 +484,7 @@ func TestAccBackupRSCloudBackupSchedule_azure(t *testing.T) { ) resource.ParallelTest(t, resource.TestCase{ - PreCheck: func() { acc.PreCheckBasic(t) }, + PreCheck: acc.PreCheckBasicSleep(t), ProtoV6ProviderFactories: acc.TestAccProviderV6Factories, CheckDestroy: checkDestroy, Steps: []resource.TestStep{ diff --git a/internal/service/cloudbackupsnapshot/resource_cloud_backup_snapshot_migration_test.go b/internal/service/cloudbackupsnapshot/resource_cloud_backup_snapshot_migration_test.go index 164cab06a7..3bac919f4b 100644 --- a/internal/service/cloudbackupsnapshot/resource_cloud_backup_snapshot_migration_test.go +++ b/internal/service/cloudbackupsnapshot/resource_cloud_backup_snapshot_migration_test.go @@ -17,7 +17,7 @@ func TestMigBackupRSCloudBackupSnapshot_basic(t *testing.T) { ) resource.ParallelTest(t, resource.TestCase{ - PreCheck: func() { mig.PreCheckBasic(t) }, + PreCheck: mig.PreCheckBasicSleep(t), CheckDestroy: checkDestroy, Steps: []resource.TestStep{ { @@ -51,7 +51,7 @@ func TestMigBackupRSCloudBackupSnapshot_sharded(t *testing.T) { ) resource.ParallelTest(t, resource.TestCase{ - PreCheck: func() { acc.PreCheckBasic(t) }, + PreCheck: mig.PreCheckBasicSleep(t), CheckDestroy: checkDestroy, Steps: []resource.TestStep{ { diff --git a/internal/service/cloudbackupsnapshot/resource_cloud_backup_snapshot_test.go b/internal/service/cloudbackupsnapshot/resource_cloud_backup_snapshot_test.go index a6cb9dec02..31a121a232 100644 --- a/internal/service/cloudbackupsnapshot/resource_cloud_backup_snapshot_test.go +++ b/internal/service/cloudbackupsnapshot/resource_cloud_backup_snapshot_test.go @@ -26,7 +26,7 @@ func TestAccBackupRSCloudBackupSnapshot_basic(t *testing.T) { ) resource.ParallelTest(t, resource.TestCase{ - PreCheck: func() { acc.PreCheckBasic(t) }, + PreCheck: acc.PreCheckBasicSleep(t), ProtoV6ProviderFactories: acc.TestAccProviderV6Factories, CheckDestroy: checkDestroy, Steps: []resource.TestStep{ @@ -75,7 +75,7 @@ func TestAccBackupRSCloudBackupSnapshot_sharded(t *testing.T) { ) resource.ParallelTest(t, resource.TestCase{ - PreCheck: func() { acc.PreCheckBasic(t) }, + PreCheck: acc.PreCheckBasicSleep(t), ProtoV6ProviderFactories: acc.TestAccProviderV6Factories, CheckDestroy: checkDestroy, Steps: []resource.TestStep{ diff --git a/internal/service/cloudbackupsnapshotexportjob/resource_cloud_backup_snapshot_export_job_test.go b/internal/service/cloudbackupsnapshotexportjob/resource_cloud_backup_snapshot_export_job_test.go index 99125326f6..9785d63bc4 100644 --- a/internal/service/cloudbackupsnapshotexportjob/resource_cloud_backup_snapshot_export_job_test.go +++ b/internal/service/cloudbackupsnapshotexportjob/resource_cloud_backup_snapshot_export_job_test.go @@ -54,7 +54,7 @@ func basicTestCase(tb testing.TB) *resource.TestCase { checks = acc.AddAttrChecks(dataSourcePluralName, checks, attrsPluralDS) return &resource.TestCase{ - PreCheck: func() { acc.PreCheckBasic(tb) }, + PreCheck: acc.PreCheckBasicSleep(tb), ExternalProviders: acc.ExternalProvidersOnlyAWS(), ProtoV6ProviderFactories: acc.TestAccProviderV6Factories, Steps: []resource.TestStep{ diff --git a/internal/service/cloudbackupsnapshotrestorejob/resource_cloud_backup_snapshot_restore_job_test.go b/internal/service/cloudbackupsnapshotrestorejob/resource_cloud_backup_snapshot_restore_job_test.go index c9e6b97f8f..d70a05526b 100644 --- a/internal/service/cloudbackupsnapshotrestorejob/resource_cloud_backup_snapshot_restore_job_test.go +++ b/internal/service/cloudbackupsnapshotrestorejob/resource_cloud_backup_snapshot_restore_job_test.go @@ -43,7 +43,7 @@ func TestAccCloudBackupSnapshotRestoreJob_basicDownload(t *testing.T) { ) resource.ParallelTest(t, resource.TestCase{ - PreCheck: func() { acc.PreCheckBasic(t) }, + PreCheck: acc.PreCheckBasicSleep(t), ProtoV6ProviderFactories: acc.TestAccProviderV6Factories, CheckDestroy: checkDestroy, Steps: []resource.TestStep{ @@ -75,7 +75,7 @@ func basicTestCase(tb testing.TB) *resource.TestCase { ) return &resource.TestCase{ - PreCheck: func() { acc.PreCheckBasic(tb) }, + PreCheck: acc.PreCheckBasicSleep(tb), ProtoV6ProviderFactories: acc.TestAccProviderV6Factories, CheckDestroy: checkDestroy, Steps: []resource.TestStep{ diff --git a/internal/service/cluster/resource_cluster_test.go b/internal/service/cluster/resource_cluster_test.go index a0c396d719..92199d7cfc 100644 --- a/internal/service/cluster/resource_cluster_test.go +++ b/internal/service/cluster/resource_cluster_test.go @@ -36,7 +36,7 @@ func basicTestCase(tb testing.TB) *resource.TestCase { ) return &resource.TestCase{ - PreCheck: func() { acc.PreCheckBasic(tb) }, + PreCheck: acc.PreCheckBasicSleep(tb), ProtoV6ProviderFactories: acc.TestAccProviderV6Factories, CheckDestroy: acc.CheckDestroyCluster, Steps: []resource.TestStep{ @@ -101,7 +101,7 @@ func partialAdvancedConfTestCase(tb testing.TB) *resource.TestCase { ) return &resource.TestCase{ - PreCheck: func() { acc.PreCheckBasic(tb) }, + PreCheck: acc.PreCheckBasicSleep(tb), ProtoV6ProviderFactories: acc.TestAccProviderV6Factories, CheckDestroy: acc.CheckDestroyCluster, Steps: []resource.TestStep{ @@ -163,7 +163,7 @@ func TestAccCluster_basic_DefaultWriteRead_AdvancedConf(t *testing.T) { ) resource.ParallelTest(t, resource.TestCase{ - PreCheck: func() { acc.PreCheckBasic(t) }, + PreCheck: acc.PreCheckBasicSleep(t), ProtoV6ProviderFactories: acc.TestAccProviderV6Factories, CheckDestroy: acc.CheckDestroyCluster, Steps: []resource.TestStep{ @@ -222,7 +222,7 @@ func TestAccCluster_emptyAdvancedConf(t *testing.T) { ) resource.ParallelTest(t, resource.TestCase{ - PreCheck: func() { acc.PreCheckBasic(t) }, + PreCheck: acc.PreCheckBasicSleep(t), ProtoV6ProviderFactories: acc.TestAccProviderV6Factories, CheckDestroy: acc.CheckDestroyCluster, Steps: []resource.TestStep{ @@ -264,7 +264,7 @@ func TestAccCluster_basicAdvancedConf(t *testing.T) { ) resource.ParallelTest(t, resource.TestCase{ - PreCheck: func() { acc.PreCheckBasic(t) }, + PreCheck: acc.PreCheckBasicSleep(t), ProtoV6ProviderFactories: acc.TestAccProviderV6Factories, CheckDestroy: acc.CheckDestroyCluster, Steps: []resource.TestStep{ @@ -625,7 +625,7 @@ func TestAccCluster_AWSWithLabels(t *testing.T) { ) resource.ParallelTest(t, resource.TestCase{ - PreCheck: func() { acc.PreCheckBasic(t) }, + PreCheck: acc.PreCheckBasicSleep(t), ProtoV6ProviderFactories: acc.TestAccProviderV6Factories, CheckDestroy: acc.CheckDestroyCluster, Steps: []resource.TestStep{ @@ -986,7 +986,7 @@ func TestAccCluster_withAutoScalingAWS(t *testing.T) { ) resource.ParallelTest(t, resource.TestCase{ - PreCheck: func() { acc.PreCheckBasic(t) }, + PreCheck: acc.PreCheckBasicSleep(t), ProtoV6ProviderFactories: acc.TestAccProviderV6Factories, CheckDestroy: acc.CheckDestroyCluster, Steps: []resource.TestStep{ @@ -1267,7 +1267,7 @@ func TestAccCluster_basicAWS_UnpauseToPaused(t *testing.T) { ) resource.ParallelTest(t, resource.TestCase{ - PreCheck: func() { acc.PreCheckBasic(t) }, + PreCheck: acc.PreCheckBasicSleep(t), ProtoV6ProviderFactories: acc.TestAccProviderV6Factories, CheckDestroy: acc.CheckDestroyCluster, Steps: []resource.TestStep{ @@ -1315,7 +1315,7 @@ func TestAccCluster_basicAWS_PausedToUnpaused(t *testing.T) { ) resource.ParallelTest(t, resource.TestCase{ - PreCheck: func() { acc.PreCheckBasic(t) }, + PreCheck: acc.PreCheckBasicSleep(t), ProtoV6ProviderFactories: acc.TestAccProviderV6Factories, CheckDestroy: acc.CheckDestroyCluster, Steps: []resource.TestStep{ diff --git a/internal/service/clusteroutagesimulation/resource_cluster_outage_simulation_test.go b/internal/service/clusteroutagesimulation/resource_cluster_outage_simulation_test.go index cd0eb7dae5..1976c09d56 100644 --- a/internal/service/clusteroutagesimulation/resource_cluster_outage_simulation_test.go +++ b/internal/service/clusteroutagesimulation/resource_cluster_outage_simulation_test.go @@ -32,7 +32,7 @@ func singleRegionTestCase(t *testing.T) *resource.TestCase { clusterName = clusterInfo.Name ) return &resource.TestCase{ - PreCheck: func() { acc.PreCheckBasic(t) }, + PreCheck: acc.PreCheckBasicSleep(t), ProtoV6ProviderFactories: acc.TestAccProviderV6Factories, CheckDestroy: checkDestroy, Steps: []resource.TestStep{ @@ -80,7 +80,7 @@ func multiRegionTestCase(t *testing.T) *resource.TestCase { ) return &resource.TestCase{ - PreCheck: func() { acc.PreCheckBasic(t) }, + PreCheck: acc.PreCheckBasicSleep(t), ProtoV6ProviderFactories: acc.TestAccProviderV6Factories, CheckDestroy: checkDestroy, Steps: []resource.TestStep{ diff --git a/internal/service/federateddatabaseinstance/resource_federated_database_instance_test.go b/internal/service/federateddatabaseinstance/resource_federated_database_instance_test.go index 41781f07a0..124ca55523 100644 --- a/internal/service/federateddatabaseinstance/resource_federated_database_instance_test.go +++ b/internal/service/federateddatabaseinstance/resource_federated_database_instance_test.go @@ -123,7 +123,7 @@ func TestAccFederatedDatabaseInstance_atlasCluster(t *testing.T) { ) resource.ParallelTest(t, resource.TestCase{ - PreCheck: func() { acc.PreCheckBasic(t) }, + PreCheck: acc.PreCheckBasicSleep(t), CheckDestroy: acc.CheckDestroyFederatedDatabaseInstance, Steps: []resource.TestStep{ { diff --git a/internal/service/globalclusterconfig/resource_global_cluster_config_test.go b/internal/service/globalclusterconfig/resource_global_cluster_config_test.go index e2760e5a81..0b53bd5794 100644 --- a/internal/service/globalclusterconfig/resource_global_cluster_config_test.go +++ b/internal/service/globalclusterconfig/resource_global_cluster_config_test.go @@ -41,7 +41,7 @@ func basicTestCase(tb testing.TB, checkZoneID, withBackup bool) *resource.TestCa } return &resource.TestCase{ - PreCheck: func() { acc.PreCheckBasic(tb) }, + PreCheck: acc.PreCheckBasicSleep(tb), ProtoV6ProviderFactories: acc.TestAccProviderV6Factories, CheckDestroy: checkDestroy, Steps: []resource.TestStep{ @@ -113,7 +113,7 @@ func TestAccGlobalClusterConfig_database(t *testing.T) { ) resource.Test(t, resource.TestCase{ - PreCheck: func() { acc.PreCheckBasic(t) }, + PreCheck: acc.PreCheckBasicSleep(t), ProtoV6ProviderFactories: acc.TestAccProviderV6Factories, CheckDestroy: checkDestroy, Steps: []resource.TestStep{ diff --git a/internal/service/ldapconfiguration/resource_ldap_configuration_test.go b/internal/service/ldapconfiguration/resource_ldap_configuration_test.go index 5fb300be5c..8dd34facfe 100644 --- a/internal/service/ldapconfiguration/resource_ldap_configuration_test.go +++ b/internal/service/ldapconfiguration/resource_ldap_configuration_test.go @@ -41,7 +41,7 @@ func TestAccLDAPConfiguration_withVerify_CACertificateComplete(t *testing.T) { ) resource.Test(t, resource.TestCase{ - PreCheck: func() { acc.PreCheckLDAPCert(t) }, + PreCheck: func() { acc.PreCheckLDAPCert(t); acc.SerialSleep(t) }, ProtoV6ProviderFactories: acc.TestAccProviderV6Factories, Steps: []resource.TestStep{ { diff --git a/internal/service/onlinearchive/resource_online_archive_migration_test.go b/internal/service/onlinearchive/resource_online_archive_migration_test.go index 6035a59544..7d380bb8da 100644 --- a/internal/service/onlinearchive/resource_online_archive_migration_test.go +++ b/internal/service/onlinearchive/resource_online_archive_migration_test.go @@ -25,7 +25,7 @@ func TestMigBackupRSOnlineArchiveWithNoChangeBetweenVersions(t *testing.T) { config := configWithDailySchedule(clusterTerraformStr, clusterResourceName, 1, deleteExpirationDays) resource.ParallelTest(t, resource.TestCase{ - PreCheck: func() { mig.PreCheckBasic(t) }, + PreCheck: mig.PreCheckBasicSleep(t), CheckDestroy: acc.CheckDestroyFederatedDatabaseInstance, Steps: []resource.TestStep{ { diff --git a/internal/service/onlinearchive/resource_online_archive_test.go b/internal/service/onlinearchive/resource_online_archive_test.go index 5f2e95b16d..8464ff3713 100644 --- a/internal/service/onlinearchive/resource_online_archive_test.go +++ b/internal/service/onlinearchive/resource_online_archive_test.go @@ -37,7 +37,7 @@ func TestAccBackupRSOnlineArchive(t *testing.T) { ) resource.ParallelTest(t, resource.TestCase{ - PreCheck: func() { acc.PreCheckBasic(t) }, + PreCheck: acc.PreCheckBasicSleep(t), ProtoV6ProviderFactories: acc.TestAccProviderV6Factories, CheckDestroy: acc.CheckDestroyCluster, Steps: []resource.TestStep{ @@ -135,7 +135,7 @@ func TestAccBackupRSOnlineArchiveBasic(t *testing.T) { ) resource.ParallelTest(t, resource.TestCase{ - PreCheck: func() { acc.PreCheckBasic(t) }, + PreCheck: acc.PreCheckBasicSleep(t), ProtoV6ProviderFactories: acc.TestAccProviderV6Factories, CheckDestroy: acc.CheckDestroyCluster, Steps: []resource.TestStep{ @@ -184,7 +184,7 @@ func TestAccBackupRSOnlineArchiveWithProcessRegion(t *testing.T) { ) resource.ParallelTest(t, resource.TestCase{ - PreCheck: func() { acc.PreCheckBasic(t) }, + PreCheck: acc.PreCheckBasicSleep(t), ProtoV6ProviderFactories: acc.TestAccProviderV6Factories, CheckDestroy: acc.CheckDestroyCluster, Steps: []resource.TestStep{ @@ -227,7 +227,7 @@ func TestAccBackupRSOnlineArchiveInvalidProcessRegion(t *testing.T) { ) resource.ParallelTest(t, resource.TestCase{ - PreCheck: func() { acc.PreCheckBasic(t) }, + PreCheck: acc.PreCheckBasicSleep(t), ProtoV6ProviderFactories: acc.TestAccProviderV6Factories, CheckDestroy: acc.CheckDestroyCluster, Steps: []resource.TestStep{ diff --git a/internal/service/privateendpointregionalmode/resource_private_endpoint_regional_mode_test.go b/internal/service/privateendpointregionalmode/resource_private_endpoint_regional_mode_test.go index 27c490da81..614451fdc5 100644 --- a/internal/service/privateendpointregionalmode/resource_private_endpoint_regional_mode_test.go +++ b/internal/service/privateendpointregionalmode/resource_private_endpoint_regional_mode_test.go @@ -41,7 +41,7 @@ func TestAccPrivateEndpointRegionalMode_conn(t *testing.T) { ) resource.Test(t, resource.TestCase{ - PreCheck: func() { acc.PreCheckAwsEnvBasic(t); acc.PreCheckAwsRegionCases(t) }, + PreCheck: func() { acc.PreCheckAwsEnvBasic(t); acc.PreCheckAwsRegionCases(t); acc.SerialSleep(t) }, ExternalProviders: acc.ExternalProvidersOnlyAWS(), ProtoV6ProviderFactories: acc.TestAccProviderV6Factories, CheckDestroy: checkDestroy, diff --git a/internal/testutil/acc/pre_check.go b/internal/testutil/acc/pre_check.go index 893d3df4ba..336962cf80 100644 --- a/internal/testutil/acc/pre_check.go +++ b/internal/testutil/acc/pre_check.go @@ -15,6 +15,16 @@ func PreCheckBasic(tb testing.TB) { } } +// PreCheckBasicSleep is a helper function to call SerialSleep, see its help for more info. +// Some examples of use are when the test is calling ProjectIDExecution or GetClusterInfo to create clusters. +func PreCheckBasicSleep(tb testing.TB) func() { + tb.Helper() + return func() { + PreCheckBasic(tb) + SerialSleep(tb) + } +} + // PreCheck checks common Atlas environment variables and MONGODB_ATLAS_PROJECT_ID. // Deprecated: it should not be used as MONGODB_ATLAS_PROJECT_ID is not intended to be used in CI. // Use PreCheckBasic instead. diff --git a/internal/testutil/acc/shared_resource.go b/internal/testutil/acc/shared_resource.go index 786fc3db32..656bb161ee 100644 --- a/internal/testutil/acc/shared_resource.go +++ b/internal/testutil/acc/shared_resource.go @@ -48,8 +48,6 @@ func ProjectIDExecution(tb testing.TB) string { sharedInfo.projectName = RandomProjectName() tb.Logf("Creating execution project: %s\n", sharedInfo.projectName) sharedInfo.projectID = createProject(tb, sharedInfo.projectName) - } else { - time.Sleep(20 * time.Second) // HELP-65223: sleep a few seconds so clusters are not created concurrently in the execution project } return sharedInfo.projectID @@ -87,10 +85,23 @@ func ClusterNameExecution(tb testing.TB) (projectID, clusterName string) { return sharedInfo.projectID, sharedInfo.clusterName } +// SerialSleep waits a few seconds so clusters are not created concurrently in the execution project, see HELP-65223. +// This must be called once the test is marked as parallel, e.g. in PreCheck inside Terraform tests. +func SerialSleep(tb testing.TB) { + tb.Helper() + SkipInUnitTest(tb) + require.True(tb, sharedInfo.init, "SetupSharedResources must called from TestMain test package") + + sharedInfo.muSleep.Lock() + defer sharedInfo.muSleep.Unlock() + time.Sleep(10 * time.Second) +} + var sharedInfo = struct { projectID string projectName string clusterName string mu sync.Mutex + muSleep sync.Mutex init bool }{} diff --git a/internal/testutil/mig/pre_check.go b/internal/testutil/mig/pre_check.go index ebd1233b18..acfc144728 100644 --- a/internal/testutil/mig/pre_check.go +++ b/internal/testutil/mig/pre_check.go @@ -12,6 +12,16 @@ func PreCheckBasic(tb testing.TB) { acc.PreCheckBasic(tb) } +// PreCheckBasicSleep is a helper function to call SerialSleep, see its help for more info. +// Some examples of use are when the test is calling ProjectIDExecution or GetClusterInfo to create clusters. +func PreCheckBasicSleep(tb testing.TB) func() { + tb.Helper() + return func() { + PreCheckBasic(tb) + acc.SerialSleep(tb) + } +} + func PreCheck(tb testing.TB) { tb.Helper() checkLastVersion(tb)