Skip to content

Commit

Permalink
tests/provider: Migrate additional tests to newer ProviderFactories s…
Browse files Browse the repository at this point in the history
…etup and PreCheck functions

Reference: #8316
Reference: #15737
Reference: #15791

This creates the remaining special `ProviderFactories` functions (as they need to exist currently), updates the Contributing Guide documentation, and migrates a portion of the tests over to them. Further changesets will continue these efforts by:

* Migrating the rest of the `awsalternate` provider test configurations to `testAccProviderFactoriesAlternate()`
* Migrating the rest of the `testAccMultipleRegionsPreCheck()` and `testAccAlternateRegionPreCheck()` usage to `testAccMultipleRegionPreCheck()` (bundling with the above as its fairly common together)
* Flipping `testAccProviderFactories` to a variable with only the `aws` provider and replacing `testAccProviderFactoriesEc2Classic` and `testAccProviderFactoriesCur()`
* Continuing efforts to remove environment variable handling in test functions

Output from acceptance testing in AWS Commercial:

```
--- PASS: TestAccAwsBackupPlan_Rule_CopyAction_CrossRegion (20.85s)

--- PASS: TestAccAWSCloudFrontDistribution_ViewerCertificate_AcmCertificateArn (157.90s)
--- PASS: TestAccAWSCloudFrontDistribution_ViewerCertificate_AcmCertificateArn_ConflictsWithCloudFrontDefaultCertificate (157.61s)

--- FAIL: TestAccAWSDBInstance_DbSubnetGroupName_RamShared (18.95s)
    resource_aws_db_instance_test.go:352: Step 1/1 error: Error running apply: 2020/10/27 23:13:26 [DEBUG] Using modified User-Agent: Terraform/0.12.29 HashiCorp-terraform-exec/0.10.0

        Error: Error associating principal with RAM resource share: UnknownResourceException: Organization o-upyv668dz5 could not be found.

        Error: error associating RAM Resource Share: InvalidParameterException: The resource you are attempting to share can only be shared within your AWS Organization. This error may also occur if you have not enabled sharing with your AWS organization, or that onboarding process is still in progress.

        Error: error associating RAM Resource Share: InvalidParameterException: The resource you are attempting to share can only be shared within your AWS Organization. This error may also occur if you have not enabled sharing with your AWS organization, or that onboarding process is still in progress.

--- FAIL: TestAccAWSDBInstance_ReplicateSourceDb_DbSubnetGroupName_RamShared (604.80s)
    resource_aws_db_instance_test.go:808: Step 1/1 error: Error running apply: 2020/10/27 21:59:55 [DEBUG] Using modified User-Agent: Terraform/0.12.29 HashiCorp-terraform-exec/0.10.0

        Error: Error associating principal with RAM resource share: UnknownResourceException: Organization o-upyv668dz5 could not be found.

        Error: error associating RAM Resource Share: InvalidParameterException: The resource you are attempting to share can only be shared within your AWS Organization. This error may also occur if you have not enabled sharing with your AWS organization, or that onboarding process is still in progress.

        Error: error associating RAM Resource Share: InvalidParameterException: The resource you are attempting to share can only be shared within your AWS Organization. This error may also occur if you have not enabled sharing with your AWS organization, or that onboarding process is still in progress.

--- FAIL: TestAccAWSDBInstance_SnapshotIdentifier_DbSubnetGroupName_RamShared (615.89s)
    resource_aws_db_instance_test.go:1437: Step 1/1 error: Error running apply: 2020/10/27 23:13:26 [DEBUG] Using modified User-Agent: Terraform/0.12.29 HashiCorp-terraform-exec/0.10.0

        Error: Error associating principal with RAM resource share: UnknownResourceException: Organization o-upyv668dz5 could not be found.

        Error: error associating RAM Resource Share: InvalidParameterException: The resource you are attempting to share can only be shared within your AWS Organization. This error may also occur if you have not enabled sharing with your AWS organization, or that onboarding process is still in progress.

        Error: error associating RAM Resource Share: InvalidParameterException: The resource you are attempting to share can only be shared within your AWS Organization. This error may also occur if you have not enabled sharing with your AWS organization, or that onboarding process is still in progress.

--- PASS: TestAccAWSDBInstance_ReplicateSourceDb_DbSubnetGroupName (2252.27s)
--- PASS: TestAccAWSDBInstance_ReplicateSourceDb_DbSubnetGroupName_VpcSecurityGroupIds (1908.33s)

--- PASS: TestAccAWSDynamoDbTable_Replica_Multiple (766.22s)
--- PASS: TestAccAWSDynamoDbTable_Replica_Single (412.01s)

--- PASS: TestAccAWSEc2TransitGatewayPeeringAttachment_basic (376.21s)
--- PASS: TestAccAWSEc2TransitGatewayPeeringAttachment_differentAccount (360.55s)
--- PASS: TestAccAWSEc2TransitGatewayPeeringAttachment_disappears (363.16s)
--- PASS: TestAccAWSEc2TransitGatewayPeeringAttachment_Tags_sameAccount (365.29s)

--- PASS: TestAccAWSEc2TransitGatewayPeeringAttachmentAccepter_basic_differentAccount (780.52s)
--- PASS: TestAccAWSEc2TransitGatewayPeeringAttachmentAccepter_basic_sameAccount (773.52s)
--- PASS: TestAccAWSEc2TransitGatewayPeeringAttachmentAccepter_Tags_sameAccount (815.32s)

--- PASS: TestAccAWSEc2TransitGatewayPeeringAttachmentDataSource_Filter_differentAccount (389.30s)
--- PASS: TestAccAWSEc2TransitGatewayPeeringAttachmentDataSource_Filter_sameAccount (397.06s)
--- PASS: TestAccAWSEc2TransitGatewayPeeringAttachmentDataSource_ID_differentAccount (333.33s)
--- PASS: TestAccAWSEc2TransitGatewayPeeringAttachmentDataSource_ID_sameAccount (333.84s)
--- PASS: TestAccAWSEc2TransitGatewayPeeringAttachmentDataSource_Tags (332.99s)

--- PASS: TestAccAWSProvider_AssumeRole_Empty (16.67s)
--- PASS: TestAccAWSProvider_Endpoints (14.28s)
--- PASS: TestAccAWSProvider_IgnoreTags_EmptyConfigurationBlock (14.21s)
--- PASS: TestAccAWSProvider_IgnoreTags_KeyPrefixes_Multiple (14.15s)
--- PASS: TestAccAWSProvider_IgnoreTags_KeyPrefixes_None (14.28s)
--- PASS: TestAccAWSProvider_IgnoreTags_KeyPrefixes_One (14.05s)
--- PASS: TestAccAWSProvider_IgnoreTags_Keys_Multiple (14.11s)
--- PASS: TestAccAWSProvider_IgnoreTags_Keys_None (14.19s)
--- PASS: TestAccAWSProvider_IgnoreTags_Keys_One (14.31s)
--- PASS: TestAccAWSProvider_Region_AwsChina (11.20s)
--- PASS: TestAccAWSProvider_Region_AwsCommercial (11.54s)
--- PASS: TestAccAWSProvider_Region_AwsGovCloudUs (11.22s)
```

Output from acceptance testing in AWS GovCloud (US):

```
--- PASS: TestAccAwsBackupPlan_Rule_CopyAction_CrossRegion (24.77s)

--- SKIP: TestAccAWSCloudFrontDistribution_ViewerCertificate_AcmCertificateArn (1.52s)
--- SKIP: TestAccAWSCloudFrontDistribution_ViewerCertificate_AcmCertificateArn_ConflictsWithCloudFrontDefaultCertificate (1.55s)
```
  • Loading branch information
bflad committed Oct 28, 2020
1 parent ee329f6 commit bfc7d1e
Show file tree
Hide file tree
Showing 10 changed files with 127 additions and 95 deletions.
18 changes: 18 additions & 0 deletions aws/cloudfront_test.go
Original file line number Diff line number Diff line change
@@ -0,0 +1,18 @@
package aws

import "github.com/aws/aws-sdk-go/aws/endpoints"

// testAccCloudfrontRegionProviderConfig is the Terraform provider configuration for CloudFront region testing
//
// Testing CloudFront assumes no other provider configurations
// are necessary and overwrites the "aws" provider configuration.
func testAccCloudfrontRegionProviderConfig() string {
switch testAccGetPartition() {
case endpoints.AwsPartitionID:
return testAccRegionalProviderConfig(endpoints.UsEast1RegionID)
case endpoints.AwsCnPartitionID:
return testAccRegionalProviderConfig(endpoints.CnNorthwest1RegionID)
default:
return testAccRegionalProviderConfig(testAccGetRegion())
}
}
27 changes: 12 additions & 15 deletions aws/data_source_aws_ec2_transit_gateway_peering_attachment_test.go
Original file line number Diff line number Diff line change
Expand Up @@ -17,10 +17,9 @@ func TestAccAWSEc2TransitGatewayPeeringAttachmentDataSource_Filter_sameAccount(t
PreCheck: func() {
testAccPreCheck(t)
testAccPreCheckAWSEc2TransitGateway(t)
testAccMultipleRegionsPreCheck(t)
testAccAlternateRegionPreCheck(t)
testAccMultipleRegionPreCheck(t, 2)
},
ProviderFactories: testAccProviderFactories(&providers),
ProviderFactories: testAccProviderFactoriesAlternate(&providers),
CheckDestroy: testAccCheckAWSEc2TransitGatewayDestroy,
Steps: []resource.TestStep{
{
Expand All @@ -46,10 +45,10 @@ func TestAccAWSEc2TransitGatewayPeeringAttachmentDataSource_Filter_differentAcco
PreCheck: func() {
testAccPreCheck(t)
testAccPreCheckAWSEc2TransitGateway(t)
testAccMultipleRegionsPreCheck(t)
testAccAlternateRegionPreCheck(t)
testAccMultipleRegionPreCheck(t, 2)
testAccAlternateAccountPreCheck(t)
},
ProviderFactories: testAccProviderFactories(&providers),
ProviderFactories: testAccProviderFactoriesAlternate(&providers),
CheckDestroy: testAccCheckAWSEc2TransitGatewayDestroy,
Steps: []resource.TestStep{
{
Expand All @@ -73,10 +72,9 @@ func TestAccAWSEc2TransitGatewayPeeringAttachmentDataSource_ID_sameAccount(t *te
PreCheck: func() {
testAccPreCheck(t)
testAccPreCheckAWSEc2TransitGateway(t)
testAccMultipleRegionsPreCheck(t)
testAccAlternateRegionPreCheck(t)
testAccMultipleRegionPreCheck(t, 2)
},
ProviderFactories: testAccProviderFactories(&providers),
ProviderFactories: testAccProviderFactoriesAlternate(&providers),
CheckDestroy: testAccCheckAWSEc2TransitGatewayDestroy,
Steps: []resource.TestStep{
{
Expand All @@ -102,10 +100,10 @@ func TestAccAWSEc2TransitGatewayPeeringAttachmentDataSource_ID_differentAccount(
PreCheck: func() {
testAccPreCheck(t)
testAccPreCheckAWSEc2TransitGateway(t)
testAccMultipleRegionsPreCheck(t)
testAccAlternateRegionPreCheck(t)
testAccMultipleRegionPreCheck(t, 2)
testAccAlternateAccountPreCheck(t)
},
ProviderFactories: testAccProviderFactories(&providers),
ProviderFactories: testAccProviderFactoriesAlternate(&providers),
CheckDestroy: testAccCheckAWSEc2TransitGatewayDestroy,
Steps: []resource.TestStep{
{
Expand All @@ -129,10 +127,9 @@ func TestAccAWSEc2TransitGatewayPeeringAttachmentDataSource_Tags(t *testing.T) {
PreCheck: func() {
testAccPreCheck(t)
testAccPreCheckAWSEc2TransitGateway(t)
testAccMultipleRegionsPreCheck(t)
testAccAlternateRegionPreCheck(t)
testAccMultipleRegionPreCheck(t, 2)
},
ProviderFactories: testAccProviderFactories(&providers),
ProviderFactories: testAccProviderFactoriesAlternate(&providers),
CheckDestroy: testAccCheckAWSEc2TransitGatewayDestroy,
Steps: []resource.TestStep{
{
Expand Down
96 changes: 62 additions & 34 deletions aws/provider_test.go
Original file line number Diff line number Diff line change
Expand Up @@ -42,11 +42,6 @@ const (

// Provider name for third configuration testing
ProviderNameAwsThird = "awsthird"

// Provider name for hardcoded us-east-1 configuration testing
//
// Deprecated: This will be replaced with service specific providers
ProviderNameAwsUsEast1 = "awsus-east-1"
)

const rfc3339RegexPattern = `^[0-9]{4}-(0[1-9]|1[012])-(0[1-9]|[12][0-9]|3[01])[Tt]([01][0-9]|2[0-3]):[0-5][0-9]:[0-5][0-9](\.[0-9]+)?([Zz]|([+-]([01][0-9]|2[0-3]):[0-5][0-9]))$`
Expand Down Expand Up @@ -99,11 +94,6 @@ func init() {
return testAccProviderFactoriesInit(providers, []string{
ProviderNameAws,
ProviderNameAwsAlternate,
ProviderNameAwsAlternateAccountAlternateRegion,
ProviderNameAwsAlternateAccountSameRegion,
ProviderNameAwsSameAccountAlternateRegion,
ProviderNameAwsThird,
ProviderNameAwsUsEast1,
})
}
testAccProviderFunc = func() *schema.Provider { return testAccProvider }
Expand All @@ -128,6 +118,56 @@ func testAccProviderFactoriesInit(providers *[]*schema.Provider, providerNames [
return factories
}

// testAccProviderFactoriesInternal creates ProviderFactories for provider configuration testing
//
// This should only be used for TestAccAWSProvider_ tests which need to
// reference the provider instance itself. Other testing should use
// testAccProviderFactories or other related functions.
func testAccProviderFactoriesInternal(providers *[]*schema.Provider) map[string]func() (*schema.Provider, error) {
return testAccProviderFactoriesInit(providers, []string{ProviderNameAws})
}

// testAccProviderFactoriesAlternate creates ProviderFactories for cross-account and cross-region configurations
//
// For cross-region testing: Typically paired with testAccMultipleRegionPreCheck and testAccAlternateRegionProviderConfig.
//
// For cross-account testing: Typically paired with testAccAlternateAccountPreCheck and testAccAlternateAccountProviderConfig.
func testAccProviderFactoriesAlternate(providers *[]*schema.Provider) map[string]func() (*schema.Provider, error) {
return testAccProviderFactoriesInit(providers, []string{
ProviderNameAws,
ProviderNameAwsAlternate,
})
}

// testAccProviderFactoriesAlternateAccountAndAlternateRegion creates ProviderFactories for cross-account and cross-region configurations
//
// Usage typically paired with testAccMultipleRegionPreCheck, testAccAlternateAccountPreCheck,
// and testAccAlternateAccountAndAlternateRegionProviderConfig.
func testAccProviderFactoriesAlternateAccountAndAlternateRegion(providers *[]*schema.Provider) map[string]func() (*schema.Provider, error) {
return testAccProviderFactoriesInit(providers, []string{
ProviderNameAws,
ProviderNameAwsAlternateAccountAlternateRegion,
ProviderNameAwsAlternateAccountSameRegion,
ProviderNameAwsSameAccountAlternateRegion,
})
}

// testAccProviderFactoriesMultipleRegion creates ProviderFactories for the number of region configurations
//
// Usage typically paired with testAccMultipleRegionPreCheck and testAccMultipleRegionProviderConfig.
func testAccProviderFactoriesMultipleRegion(providers *[]*schema.Provider, regions int) map[string]func() (*schema.Provider, error) {
providerNames := []string{
ProviderNameAws,
ProviderNameAwsAlternate,
}

if regions >= 3 {
providerNames = append(providerNames, ProviderNameAwsThird)
}

return testAccProviderFactoriesInit(providers, providerNames)
}

func TestProvider(t *testing.T) {
if err := Provider().InternalValidate(); err != nil {
t.Fatalf("err: %s", err)
Expand Down Expand Up @@ -816,18 +856,6 @@ provider "aws" {
`, region)
}

// Provider configuration hardcoded for us-east-1.
// This should only be necessary for testing ACM Certificates with CloudFront
// related infrastucture such as API Gateway Domain Names for EDGE endpoints,
// CloudFront Distribution Viewer Certificates, and Cognito User Pool Domains.
// Other valid usage is for services only available in us-east-1 such as the
// Cost and Usage Reporting and Pricing services.
//
// Deprecated: This will be replaced with service specific provider configurations.
func testAccUsEast1RegionProviderConfig() string {
return testAccNamedRegionalProviderConfig(ProviderNameAwsUsEast1, endpoints.UsEast1RegionID)
}

func testAccAwsRegionProviderFunc(region string, providers *[]*schema.Provider) func() *schema.Provider {
return func() *schema.Provider {
if region == "" {
Expand Down Expand Up @@ -991,7 +1019,7 @@ func TestAccAWSProvider_Endpoints(t *testing.T) {

resource.ParallelTest(t, resource.TestCase{
PreCheck: func() { testAccPreCheck(t) },
ProviderFactories: testAccProviderFactories(&providers),
ProviderFactories: testAccProviderFactoriesInternal(&providers),
CheckDestroy: nil,
Steps: []resource.TestStep{
{
Expand All @@ -1009,7 +1037,7 @@ func TestAccAWSProvider_IgnoreTags_EmptyConfigurationBlock(t *testing.T) {

resource.ParallelTest(t, resource.TestCase{
PreCheck: func() { testAccPreCheck(t) },
ProviderFactories: testAccProviderFactories(&providers),
ProviderFactories: testAccProviderFactoriesInternal(&providers),
CheckDestroy: nil,
Steps: []resource.TestStep{
{
Expand All @@ -1028,7 +1056,7 @@ func TestAccAWSProvider_IgnoreTags_KeyPrefixes_None(t *testing.T) {

resource.ParallelTest(t, resource.TestCase{
PreCheck: func() { testAccPreCheck(t) },
ProviderFactories: testAccProviderFactories(&providers),
ProviderFactories: testAccProviderFactoriesInternal(&providers),
CheckDestroy: nil,
Steps: []resource.TestStep{
{
Expand All @@ -1046,7 +1074,7 @@ func TestAccAWSProvider_IgnoreTags_KeyPrefixes_One(t *testing.T) {

resource.ParallelTest(t, resource.TestCase{
PreCheck: func() { testAccPreCheck(t) },
ProviderFactories: testAccProviderFactories(&providers),
ProviderFactories: testAccProviderFactoriesInternal(&providers),
CheckDestroy: nil,
Steps: []resource.TestStep{
{
Expand All @@ -1064,7 +1092,7 @@ func TestAccAWSProvider_IgnoreTags_KeyPrefixes_Multiple(t *testing.T) {

resource.ParallelTest(t, resource.TestCase{
PreCheck: func() { testAccPreCheck(t) },
ProviderFactories: testAccProviderFactories(&providers),
ProviderFactories: testAccProviderFactoriesInternal(&providers),
CheckDestroy: nil,
Steps: []resource.TestStep{
{
Expand All @@ -1082,7 +1110,7 @@ func TestAccAWSProvider_IgnoreTags_Keys_None(t *testing.T) {

resource.ParallelTest(t, resource.TestCase{
PreCheck: func() { testAccPreCheck(t) },
ProviderFactories: testAccProviderFactories(&providers),
ProviderFactories: testAccProviderFactoriesInternal(&providers),
CheckDestroy: nil,
Steps: []resource.TestStep{
{
Expand All @@ -1100,7 +1128,7 @@ func TestAccAWSProvider_IgnoreTags_Keys_One(t *testing.T) {

resource.ParallelTest(t, resource.TestCase{
PreCheck: func() { testAccPreCheck(t) },
ProviderFactories: testAccProviderFactories(&providers),
ProviderFactories: testAccProviderFactoriesInternal(&providers),
CheckDestroy: nil,
Steps: []resource.TestStep{
{
Expand All @@ -1118,7 +1146,7 @@ func TestAccAWSProvider_IgnoreTags_Keys_Multiple(t *testing.T) {

resource.ParallelTest(t, resource.TestCase{
PreCheck: func() { testAccPreCheck(t) },
ProviderFactories: testAccProviderFactories(&providers),
ProviderFactories: testAccProviderFactoriesInternal(&providers),
CheckDestroy: nil,
Steps: []resource.TestStep{
{
Expand All @@ -1136,7 +1164,7 @@ func TestAccAWSProvider_Region_AwsChina(t *testing.T) {

resource.ParallelTest(t, resource.TestCase{
PreCheck: func() { testAccPreCheck(t) },
ProviderFactories: testAccProviderFactories(&providers),
ProviderFactories: testAccProviderFactoriesInternal(&providers),
CheckDestroy: nil,
Steps: []resource.TestStep{
{
Expand All @@ -1156,7 +1184,7 @@ func TestAccAWSProvider_Region_AwsCommercial(t *testing.T) {

resource.ParallelTest(t, resource.TestCase{
PreCheck: func() { testAccPreCheck(t) },
ProviderFactories: testAccProviderFactories(&providers),
ProviderFactories: testAccProviderFactoriesInternal(&providers),
CheckDestroy: nil,
Steps: []resource.TestStep{
{
Expand All @@ -1176,7 +1204,7 @@ func TestAccAWSProvider_Region_AwsGovCloudUs(t *testing.T) {

resource.ParallelTest(t, resource.TestCase{
PreCheck: func() { testAccPreCheck(t) },
ProviderFactories: testAccProviderFactories(&providers),
ProviderFactories: testAccProviderFactoriesInternal(&providers),
CheckDestroy: nil,
Steps: []resource.TestStep{
{
Expand All @@ -1196,7 +1224,7 @@ func TestAccAWSProvider_AssumeRole_Empty(t *testing.T) {

resource.ParallelTest(t, resource.TestCase{
PreCheck: func() { testAccPreCheck(t) },
ProviderFactories: testAccProviderFactories(&providers),
ProviderFactories: testAccProviderFactoriesInternal(&providers),
CheckDestroy: nil,
Steps: []resource.TestStep{
{
Expand Down
5 changes: 2 additions & 3 deletions aws/resource_aws_backup_plan_test.go
Original file line number Diff line number Diff line change
Expand Up @@ -436,10 +436,9 @@ func TestAccAwsBackupPlan_Rule_CopyAction_CrossRegion(t *testing.T) {
PreCheck: func() {
testAccPreCheck(t)
testAccPreCheckAWSBackup(t)
testAccMultipleRegionsPreCheck(t)
testAccAlternateRegionPreCheck(t)
testAccMultipleRegionPreCheck(t, 2)
},
ProviderFactories: testAccProviderFactories(&providers),
ProviderFactories: testAccProviderFactoriesAlternate(&providers),
CheckDestroy: testAccCheckAwsBackupPlanDestroy,
Steps: []resource.TestStep{
{
Expand Down
4 changes: 1 addition & 3 deletions aws/resource_aws_cloudfront_distribution_test.go
Original file line number Diff line number Diff line change
Expand Up @@ -2538,10 +2538,8 @@ func testAccAWSCloudFrontDistributionConfigViewerCertificateAcmCertificateArnBas
key := tlsRsaPrivateKeyPem(2048)
certificate := tlsRsaX509SelfSignedCertificatePem(key, commonName)

return testAccUsEast1RegionProviderConfig() + fmt.Sprintf(`
return testAccCloudfrontRegionProviderConfig() + fmt.Sprintf(`
resource "aws_acm_certificate" "test" {
provider = "awsus-east-1"
certificate_body = "%[1]s"
private_key = "%[2]s"
}
Expand Down
19 changes: 8 additions & 11 deletions aws/resource_aws_db_instance_test.go
Original file line number Diff line number Diff line change
Expand Up @@ -355,7 +355,7 @@ func TestAccAWSDBInstance_DbSubnetGroupName_RamShared(t *testing.T) {
testAccAlternateAccountPreCheck(t)
testAccOrganizationsEnabledPreCheck(t)
},
ProviderFactories: testAccProviderFactories(&providers),
ProviderFactories: testAccProviderFactoriesAlternate(&providers),
CheckDestroy: testAccCheckAWSDBInstanceDestroy,
Steps: []resource.TestStep{
{
Expand Down Expand Up @@ -778,10 +778,9 @@ func TestAccAWSDBInstance_ReplicateSourceDb_DbSubnetGroupName(t *testing.T) {
resource.ParallelTest(t, resource.TestCase{
PreCheck: func() {
testAccPreCheck(t)
testAccMultipleRegionsPreCheck(t)
testAccAlternateRegionPreCheck(t)
testAccMultipleRegionPreCheck(t, 2)
},
ProviderFactories: testAccProviderFactories(&providers),
ProviderFactories: testAccProviderFactoriesAlternate(&providers),
CheckDestroy: testAccCheckAWSDBInstanceDestroy,
Steps: []resource.TestStep{
{
Expand All @@ -808,12 +807,11 @@ func TestAccAWSDBInstance_ReplicateSourceDb_DbSubnetGroupName_RamShared(t *testi
resource.ParallelTest(t, resource.TestCase{
PreCheck: func() {
testAccPreCheck(t)
testAccMultipleRegionsPreCheck(t)
testAccAlternateRegionPreCheck(t)
testAccMultipleRegionPreCheck(t, 2)
testAccAlternateAccountPreCheck(t)
testAccOrganizationsEnabledPreCheck(t)
},
ProviderFactories: testAccProviderFactories(&providers),
ProviderFactories: testAccProviderFactoriesAlternateAccountAndAlternateRegion(&providers),
CheckDestroy: testAccCheckAWSDBInstanceDestroy,
Steps: []resource.TestStep{
{
Expand All @@ -840,10 +838,9 @@ func TestAccAWSDBInstance_ReplicateSourceDb_DbSubnetGroupName_VpcSecurityGroupId
resource.ParallelTest(t, resource.TestCase{
PreCheck: func() {
testAccPreCheck(t)
testAccMultipleRegionsPreCheck(t)
testAccAlternateRegionPreCheck(t)
testAccMultipleRegionPreCheck(t, 2)
},
ProviderFactories: testAccProviderFactories(&providers),
ProviderFactories: testAccProviderFactoriesAlternate(&providers),
CheckDestroy: testAccCheckAWSDBInstanceDestroy,
Steps: []resource.TestStep{
{
Expand Down Expand Up @@ -1443,7 +1440,7 @@ func TestAccAWSDBInstance_SnapshotIdentifier_DbSubnetGroupName_RamShared(t *test
testAccAlternateAccountPreCheck(t)
testAccOrganizationsEnabledPreCheck(t)
},
ProviderFactories: testAccProviderFactories(&providers),
ProviderFactories: testAccProviderFactoriesAlternate(&providers),
CheckDestroy: testAccCheckAWSDBInstanceDestroy,
Steps: []resource.TestStep{
{
Expand Down
4 changes: 2 additions & 2 deletions aws/resource_aws_dynamodb_table_test.go
Original file line number Diff line number Diff line change
Expand Up @@ -1402,7 +1402,7 @@ func TestAccAWSDynamoDbTable_Replica_Multiple(t *testing.T) {
testAccPreCheck(t)
testAccMultipleRegionPreCheck(t, 3)
},
ProviderFactories: testAccProviderFactories(&providers),
ProviderFactories: testAccProviderFactoriesMultipleRegion(&providers, 3),
CheckDestroy: testAccCheckAWSDynamoDbTableDestroy,
Steps: []resource.TestStep{
{
Expand Down Expand Up @@ -1447,7 +1447,7 @@ func TestAccAWSDynamoDbTable_Replica_Single(t *testing.T) {
testAccPreCheck(t)
testAccMultipleRegionPreCheck(t, 2)
},
ProviderFactories: testAccProviderFactories(&providers),
ProviderFactories: testAccProviderFactoriesMultipleRegion(&providers, 3), // 3 due to shared test configuration
CheckDestroy: testAccCheckAWSDynamoDbTableDestroy,
Steps: []resource.TestStep{
{
Expand Down
Loading

0 comments on commit bfc7d1e

Please sign in to comment.