-
Notifications
You must be signed in to change notification settings - Fork 9.2k
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
Tech debt: Use standard cross-account acceptance testing setup #10333
Comments
Hi, I'd like to contribute. Should each hard coded value be replaced with the alternate region functions or should the tests be extended to test on both default and alternate regions? |
@RickyRajinder Thanks for volunteering 👏. Looking at for example
provider "aws" {
alias = "useast1"
region = "us-east-1"
}
provider "aws" {
alias = "uswest2"
region = "us-west-2"
}
return fmt.Sprintf(` with return testAccAlternateRegionProviderConfig() + fmt.Sprintf(`
data "aws_availability_zones" "us-east-1" {
provider = "aws.useast1"
} with data "aws_availability_zones" "current" {} and changing associated references
data "aws_region" "alternate" {
provider = "aws.alternate"
}
data "aws_partition" "current" {} and replacing replication_source_identifier = "arn:aws:rds:us-west-2:${data.aws_caller_identity.current.account_id}:cluster:${aws_rds_cluster.test_primary.cluster_identifier}" with replication_source_identifier = "arn:${data.aws_partition.current.partition}:rds:${data.aws_region.alternate.name}:${data.aws_caller_identity.current.account_id}:cluster:${aws_rds_cluster.test_primary.cluster_identifier}"
and in
PreCheck: func() { testAccPreCheck(t) }, with PreCheck: func() {
testAccPreCheck(t)
testAccMultipleRegionsPreCheck(t)
testAccAlternateRegionPreCheck(t)
},
CheckDestroy: testAccCheckWithProviders(testAccCheckAWSClusterDestroyWithProvider, &providers), with CheckDestroy: testAccCheckAWSClusterDestroy,
Check: resource.ComposeTestCheckFunc(
testAccCheckAWSClusterExistsWithProvider(resourceName,
&primaryCluster, testAccAwsRegionProviderFunc("us-west-2", &providers)),
testAccCheckAWSClusterExistsWithProvider(resourceName2,
&replicaCluster, testAccAwsRegionProviderFunc("us-east-1", &providers)),
), with Check: resource.ComposeTestCheckFunc(
testAccCheckAWSClusterExists(resourceName, &primaryCluster),
testAccCheckAWSClusterExistsWithProvider(resourceName2,
&replicaCluster, testAccAwsRegionProviderFunc(testAccGetAlternateRegion(), &providers)),
), |
Also in |
Re-evaluate once #12277 et al. are merged. |
Revisit for v3.x after #14312 is merged. |
…ter_EncryptedCrossRegionReplication Reference: #10333 Reference: #14384 Previously: ``` TestAccAWSRDSCluster_EncryptedCrossRegionReplication: testing.go:684: Step 0 error: errors during apply: Error: error creating RDS cluster: InvalidParameterCombination: Cannot specify database name for cross region replication cluster ``` Output from acceptance testing: ``` --- PASS: TestAccAWSRDSCluster_ReplicationSourceIdentifier_KmsKeyId (1545.00s) ```
Reference: #10333 Reference: #13527 Reference: #13826 Reference: #14215 Changes: * Add disappears testing to aws_route53_vpc_association_authorization. * Ensure aws_route53_vpc_association_authorization example shows implicit ordering for downstream aws_route53_zone_association usage * Fix aws_route53_zone_association VPC Region handling by including it in the ID, falling back to the attribute state, or falling back to the provider region. Document additional import handling. * Add aws_route53_zone_association error handling to remove resource from state. * Standardize aws_route53_zone_association disappears testing. Output from acceptance testing: ``` --- PASS: TestAccAWSRoute53VpcAssociationAuthorization_disappears (110.26s) --- PASS: TestAccAWSRoute53VpcAssociationAuthorization_basic (113.19s) --- PASS: TestAccAWSRoute53ZoneAssociation_CrossAccount (211.48s) --- PASS: TestAccAWSRoute53ZoneAssociation_CrossRegion (275.34s) --- PASS: TestAccAWSRoute53ZoneAssociation_disappears_Zone (280.22s) --- PASS: TestAccAWSRoute53ZoneAssociation_disappears (281.72s) --- PASS: TestAccAWSRoute53ZoneAssociation_disappears_VPC (281.85s) --- PASS: TestAccAWSRoute53ZoneAssociation_basic (283.83s) ```
…ter_EncryptedCrossRegionReplication (#14491) Reference: #10333 Reference: #14384 Previously: ``` TestAccAWSRDSCluster_EncryptedCrossRegionReplication: testing.go:684: Step 0 error: errors during apply: Error: error creating RDS cluster: InvalidParameterCombination: Cannot specify database name for cross region replication cluster ``` Output from acceptance testing: ``` --- PASS: TestAccAWSRDSCluster_ReplicationSourceIdentifier_KmsKeyId (1545.00s) ```
Closing as this is being/has been addressed via the linked issues. |
I'm going to lock this issue because it has been closed for 30 days ⏳. This helps our maintainers find and focus on the active issues. If you feel this issue should be reopened, we encourage creating a new issue linking back to this one for added context. Thanks! |
Community Note
Description
#7627 added standard cross-account acceptance testing setup functions
testAccAlternateRegionProviderConfig()
,testAccGetAlternateRegion()
etc.Ensure that these functions are used in acceptance tests for other cross-region resources.
aws_instance
-TestAccAWSInstance_multipleRegions()
aws_rds_cluster
-TestAccAWSRDSCluster_EncryptedCrossRegionReplication()
aws_route53_zone_association
-TestAccAWSRoute53ZoneAssociation_region()
aws_s3_bucket
- MultipleRelated:
The text was updated successfully, but these errors were encountered: