Skip to content
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

tests: Simplify multi-region test logic #3413

Merged
merged 1 commit into from
Feb 16, 2018
Merged

tests: Simplify multi-region test logic #3413

merged 1 commit into from
Feb 16, 2018

Conversation

radeksimko
Copy link
Member

@radeksimko radeksimko commented Feb 16, 2018

There is a couple of benefits we gain from this refactoring:

  • less duplicated code (especially duplicate providerFactories := map[string]terraform.ResourceProviderFactory blocks in each test)
  • it should be now more obvious from looking at the test body which region is each function checking
  • more precise checks with no false positives and less API calls - i.e. we no longer check resource's existence via each applicable (AWS) provider, but instead pick only the one for the right region
  • nil checks are kept in a single place, no more spreading around tests. Test now always gets a valid provider pointer.

Test results

=== RUN   TestAccAWSVPCPeeringConnection_region
--- PASS: TestAccAWSVPCPeeringConnection_region (29.16s)
=== RUN   TestAccAWSS3Bucket_ReplicationExpectVersioningValidationError
--- PASS: TestAccAWSS3Bucket_ReplicationExpectVersioningValidationError (32.11s)
=== RUN   TestAccAWSVPCPeeringConnectionAccepter_differentRegion
--- PASS: TestAccAWSVPCPeeringConnectionAccepter_differentRegion (36.30s)
=== RUN   TestAccAWSS3Bucket_ReplicationWithoutStorageClass
--- PASS: TestAccAWSS3Bucket_ReplicationWithoutStorageClass (48.38s)
=== RUN   TestAccAWSRoute53Zone_private_region
--- PASS: TestAccAWSRoute53Zone_private_region (68.29s)
=== RUN   TestAccAWSS3Bucket_Replication
--- PASS: TestAccAWSS3Bucket_Replication (74.84s)
=== RUN   TestAccAWSRoute53ZoneAssociation_region
--- PASS: TestAccAWSRoute53ZoneAssociation_region (105.09s)
=== RUN   TestAccAWSInstance_multipleRegions
--- PASS: TestAccAWSInstance_multipleRegions (232.98s)
=== RUN   TestAccAWSRoute53Zone_forceDestroy
--- PASS: TestAccAWSRoute53Zone_forceDestroy (343.23s)

@radeksimko radeksimko added the tests PRs: expanded test coverage. Issues: expanded coverage, enhancements to test infrastructure. label Feb 16, 2018
@ghost ghost added the size/XL Managed by automation to categorize the size of a PR. label Feb 16, 2018
Copy link
Contributor

@bflad bflad left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

This is awesome! Thanks for the cleanup.

@radeksimko radeksimko merged commit 14cb471 into master Feb 16, 2018
@radeksimko radeksimko deleted the t-multi-region branch February 16, 2018 16:02
@ghost
Copy link

ghost commented Apr 7, 2020

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!

@ghost ghost locked and limited conversation to collaborators Apr 7, 2020
Sign up for free to subscribe to this conversation on GitHub. Already have an account? Sign in.
Labels
size/XL Managed by automation to categorize the size of a PR. tests PRs: expanded test coverage. Issues: expanded coverage, enhancements to test infrastructure.
Projects
None yet
Development

Successfully merging this pull request may close these issues.

2 participants