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/provider: Remove extraneously hardcoded provider configurations in test configurations #12277

Merged
merged 1 commit into from
Mar 10, 2020

Conversation

bflad
Copy link
Contributor

@bflad bflad commented Mar 5, 2020

Community Note

  • Please vote on this pull request by adding a 👍 reaction to the original pull request comment to help the community and maintainers prioritize this request
  • Please do not leave "+1" or other comments that do not add relevant new information or questions, they generate extra noise for pull request followers and do not help prioritize the request

Reference: #8983
Reference: https://github.com/terraform-providers/terraform-provider-aws/blob/master/.github/CONTRIBUTING.md#writing-and-running-cross-region-acceptance-tests

Release note for CHANGELOG:

NONE

This is the first round of tfproviderlint AT004 fixes. Remaining reports will require some additional design work, e.g. potentially creating a separate EC2 Classic provider in the acceptance testing framework.

Previously:

aws/data_source_aws_elastic_beanstalk_hosted_zone_test.go:42:75: AT004: provider declaration should be omitted
aws/provider_test.go:425:21: AT004: provider declaration should be omitted
...
aws/provider_test.go:1259:21: AT004: provider declaration should be omitted
aws/resource_aws_ami_from_instance_test.go:131:21: AT004: provider declaration should be omitted
aws/resource_aws_codecommit_trigger_test.go:84:40: AT004: provider declaration should be omitted
aws/resource_aws_dynamodb_global_table_test.go:186:21: AT004: provider declaration should be omitted
aws/resource_aws_eip_test.go:999:21: AT004: provider declaration should be
aws/resource_aws_pinpoint_adm_channel_test.go:115:21: AT004: provider declaration should be omitted
aws/resource_aws_pinpoint_apns_channel_test.go:197:21: AT004: provider declaration should be omitted
aws/resource_aws_pinpoint_apns_channel_test.go:215:21: AT004: provider declaration should be omitted
aws/resource_aws_pinpoint_apns_sandbox_channel_test.go:197:21: AT004: provider declaration should be omitted
aws/resource_aws_pinpoint_apns_sandbox_channel_test.go:215:21: AT004: provider declaration should be omitted
aws/resource_aws_pinpoint_apns_voip_channel_test.go:197:21: AT004: provider declaration should be omitted
aws/resource_aws_pinpoint_apns_voip_channel_test.go:215:21: AT004: provider declaration should be omitted
aws/resource_aws_pinpoint_apns_voip_sandbox_channel_test.go:197:21: AT004: provider declaration should be omitted
aws/resource_aws_pinpoint_apns_voip_sandbox_channel_test.go:215:21: AT004: provider declaration should be omitted
aws/resource_aws_pinpoint_baidu_channel_test.go:109:21: AT004: provider declaration should be omitted
aws/resource_aws_pinpoint_baidu_channel_test.go:91:21: AT004: provider declaration should be omitted
aws/resource_aws_pinpoint_email_channel_test.go:141:53: AT004: provider declaration should be omitted
aws/resource_aws_pinpoint_email_channel_test.go:83:52: AT004: provider declaration should be omitted
aws/resource_aws_pinpoint_event_stream_test.go:136:52: AT004: provider declaration should be omitted
aws/resource_aws_pinpoint_event_stream_test.go:79:51: AT004: provider declaration should be omitted
aws/resource_aws_pinpoint_gcm_channel_test.go:95:21: AT004: provider declaration should be omitted
aws/resource_aws_pinpoint_sms_channel_test.go:146:50: AT004: provider declaration should be omitted
aws/resource_aws_pinpoint_sms_channel_test.go:158:21: AT004: provider declaration should be omitted
aws/resource_aws_rds_cluster_test.go:2796:21: AT004: provider declaration should be omitted
aws/resource_aws_route53_zone_association_test.go:267:51: AT004: provider declaration should be omitted
aws/resource_aws_s3_bucket_test.go:2772:21: AT004: provider declaration should be omitted
aws/resource_aws_s3_bucket_test.go:3268:50: AT004: provider declaration should be omitted

Output from acceptance testing:

--- PASS: TestAccAWSDataSourceElasticBeanstalkHostedZone_basic (15.30s)
--- PASS: TestAccAWSDataSourceElasticBeanstalkHostedZone_Region (19.40s)

--- PASS: TestAccAWSAMIFromInstance_basic (458.33s)
--- PASS: TestAccAWSAMIFromInstance_tags (459.26s)

--- PASS: TestAccAWSCodeCommitTrigger_basic (16.98s)

--- PASS: TestAccAWSDynamoDbGlobalTable_multipleRegions (107.60s)

--- PASS: TestAccAWSEIP_Instance_Reassociate (120.78s)

--- SKIP: TestAccAWSPinpointADMChannel_basic (0.00s)
    resource_aws_pinpoint_adm_channel_test.go:30: ADM_CLIENT_ID ENV is missing

--- SKIP: TestAccAWSPinpointAPNSChannel_basicCertificate (0.00s)
    resource_aws_pinpoint_apns_channel_test.go:58: Pinpoint certificate credentials envs are missing, skipping test
--- SKIP: TestAccAWSPinpointAPNSChannel_basicToken (0.00s)
    resource_aws_pinpoint_apns_channel_test.go:66: APNS_BUNDLE_ID env is missing, skipping test

--- SKIP: TestAccAWSPinpointAPNSSandboxChannel_basicCertificate (0.00s)
    resource_aws_pinpoint_apns_sandbox_channel_test.go:58: Pinpoint certificate credentials envs are missing, skipping test
--- SKIP: TestAccAWSPinpointAPNSSandboxChannel_basicToken (0.00s)
    resource_aws_pinpoint_apns_sandbox_channel_test.go:66: APNS_SANDBOX_BUNDLE_ID env is missing, skipping test

--- SKIP: TestAccAWSPinpointAPNSVoipChannel_basicCertificate (0.00s)
    resource_aws_pinpoint_apns_voip_channel_test.go:58: Pinpoint certificate credentials envs are missing, skipping test
--- SKIP: TestAccAWSPinpointAPNSVoipChannel_basicToken (0.00s)
    resource_aws_pinpoint_apns_voip_channel_test.go:66: APNS_VOIP_BUNDLE_ID env is missing, skipping test

--- SKIP: TestAccAWSPinpointAPNSVoipSandboxChannel_basicCertificate (0.00s)
    resource_aws_pinpoint_apns_voip_sandbox_channel_test.go:58: Pinpoint certificate credentials envs are missing, skipping test
--- SKIP: TestAccAWSPinpointAPNSVoipSandboxChannel_basicToken (0.00s)
    resource_aws_pinpoint_apns_voip_sandbox_channel_test.go:66: APNS_VOIP_BUNDLE_ID env is missing, skipping test

--- SKIP: TestAccAWSPinpointGCMChannel_basic (0.00s)
    resource_aws_pinpoint_gcm_channel_test.go:26: GCM_API_KEY env missing, skip test

--- PASS: TestAccAWSPinpointApp_basic (18.30s)
--- PASS: TestAccAWSPinpointApp_CampaignHookLambda (51.62s)
--- PASS: TestAccAWSPinpointApp_Limits (16.81s)
--- PASS: TestAccAWSPinpointApp_QuietTime (16.39s)
--- PASS: TestAccAWSPinpointApp_Tags (39.82s)

--- PASS: TestAccAWSPinpointBaiduChannel_basic (27.75s)

--- PASS: TestAccAWSPinpointEmailChannel_basic (31.77s)

--- PASS: TestAccAWSPinpointEventStream_basic (192.97s)

--- PASS: TestAccAWSPinpointSMSChannel_basic (27.71s)
--- PASS: TestAccAWSPinpointSMSChannel_full (29.13s)

--- PASS: TestAccAWSRDSCluster_EncryptedCrossRegionReplication (1593.29s)

--- PASS: TestAccAWSRoute53ZoneAssociation_region (161.54s)

--- PASS: TestAccAWSS3Bucket_region (38.19s)
--- PASS: TestAccAWSS3Bucket_ReplicationExpectVersioningValidationError (28.48s)
--- PASS: TestAccAWSS3Bucket_ReplicationWithoutPrefix (55.65s)
--- PASS: TestAccAWSS3Bucket_ReplicationWithoutStorageClass (56.38s)
--- PASS: TestAccAWSS3Bucket_ReplicationConfiguration_Rule_Destination_AccessControlTranslation (108.97s)
--- PASS: TestAccAWSS3Bucket_ReplicationSchemaV2 (161.13s)
--- PASS: TestAccAWSS3Bucket_Replication (172.15s)

In a region where Pinpoint is not supported, all tests continue to skip:

--- SKIP: TestAccAWSPinpointApp_basic (27.81s)
    resource_aws_pinpoint_app_test.go:228: skipping acceptance testing: RequestError: send request failed
        caused by: Get https://pinpoint.us-east-2.amazonaws.com/v1/apps: dial tcp: lookup pinpoint.us-east-2.amazonaws.com: no such host

… in test configurations

Reference: #8983
Reference: https://github.com/terraform-providers/terraform-provider-aws/blob/master/.github/CONTRIBUTING.md#writing-and-running-cross-region-acceptance-tests

This is the first round of tfproviderlint AT004 fixes. Remaining reports will require some additional design work, e.g. potentially creating a separate EC2 Classic provider in the acceptance testing framework.

Previously:

```
aws/data_source_aws_elastic_beanstalk_hosted_zone_test.go:42:75: AT004: provider declaration should be omitted
aws/provider_test.go:425:21: AT004: provider declaration should be omitted
...
aws/provider_test.go:1259:21: AT004: provider declaration should be omitted
aws/resource_aws_ami_from_instance_test.go:131:21: AT004: provider declaration should be omitted
aws/resource_aws_codecommit_trigger_test.go:84:40: AT004: provider declaration should be omitted
aws/resource_aws_dynamodb_global_table_test.go:186:21: AT004: provider declaration should be omitted
aws/resource_aws_eip_test.go:999:21: AT004: provider declaration should be
aws/resource_aws_pinpoint_adm_channel_test.go:115:21: AT004: provider declaration should be omitted
aws/resource_aws_pinpoint_apns_channel_test.go:197:21: AT004: provider declaration should be omitted
aws/resource_aws_pinpoint_apns_channel_test.go:215:21: AT004: provider declaration should be omitted
aws/resource_aws_pinpoint_apns_sandbox_channel_test.go:197:21: AT004: provider declaration should be omitted
aws/resource_aws_pinpoint_apns_sandbox_channel_test.go:215:21: AT004: provider declaration should be omitted
aws/resource_aws_pinpoint_apns_voip_channel_test.go:197:21: AT004: provider declaration should be omitted
aws/resource_aws_pinpoint_apns_voip_channel_test.go:215:21: AT004: provider declaration should be omitted
aws/resource_aws_pinpoint_apns_voip_sandbox_channel_test.go:197:21: AT004: provider declaration should be omitted
aws/resource_aws_pinpoint_apns_voip_sandbox_channel_test.go:215:21: AT004: provider declaration should be omitted
aws/resource_aws_pinpoint_baidu_channel_test.go:109:21: AT004: provider declaration should be omitted
aws/resource_aws_pinpoint_baidu_channel_test.go:91:21: AT004: provider declaration should be omitted
aws/resource_aws_pinpoint_email_channel_test.go:141:53: AT004: provider declaration should be omitted
aws/resource_aws_pinpoint_email_channel_test.go:83:52: AT004: provider declaration should be omitted
aws/resource_aws_pinpoint_event_stream_test.go:136:52: AT004: provider declaration should be omitted
aws/resource_aws_pinpoint_event_stream_test.go:79:51: AT004: provider declaration should be omitted
aws/resource_aws_pinpoint_gcm_channel_test.go:95:21: AT004: provider declaration should be omitted
aws/resource_aws_pinpoint_sms_channel_test.go:146:50: AT004: provider declaration should be omitted
aws/resource_aws_pinpoint_sms_channel_test.go:158:21: AT004: provider declaration should be omitted
aws/resource_aws_rds_cluster_test.go:2796:21: AT004: provider declaration should be omitted
aws/resource_aws_route53_zone_association_test.go:267:51: AT004: provider declaration should be omitted
aws/resource_aws_s3_bucket_test.go:2772:21: AT004: provider declaration should be omitted
aws/resource_aws_s3_bucket_test.go:3268:50: AT004: provider declaration should be omitted
```

Output from acceptance testing:

```
--- PASS: TestAccAWSDataSourceElasticBeanstalkHostedZone_basic (15.30s)
--- PASS: TestAccAWSDataSourceElasticBeanstalkHostedZone_Region (19.40s)

--- PASS: TestAccAWSAMIFromInstance_basic (458.33s)
--- PASS: TestAccAWSAMIFromInstance_tags (459.26s)

--- PASS: TestAccAWSCodeCommitTrigger_basic (16.98s)

--- PASS: TestAccAWSDynamoDbGlobalTable_multipleRegions (107.60s)

--- PASS: TestAccAWSEIP_Instance_Reassociate (120.78s)

--- SKIP: TestAccAWSPinpointADMChannel_basic (0.00s)
    resource_aws_pinpoint_adm_channel_test.go:30: ADM_CLIENT_ID ENV is missing

--- SKIP: TestAccAWSPinpointAPNSChannel_basicCertificate (0.00s)
    resource_aws_pinpoint_apns_channel_test.go:58: Pinpoint certificate credentials envs are missing, skipping test
--- SKIP: TestAccAWSPinpointAPNSChannel_basicToken (0.00s)
    resource_aws_pinpoint_apns_channel_test.go:66: APNS_BUNDLE_ID env is missing, skipping test

--- SKIP: TestAccAWSPinpointAPNSSandboxChannel_basicCertificate (0.00s)
    resource_aws_pinpoint_apns_sandbox_channel_test.go:58: Pinpoint certificate credentials envs are missing, skipping test
--- SKIP: TestAccAWSPinpointAPNSSandboxChannel_basicToken (0.00s)
    resource_aws_pinpoint_apns_sandbox_channel_test.go:66: APNS_SANDBOX_BUNDLE_ID env is missing, skipping test

--- SKIP: TestAccAWSPinpointAPNSVoipChannel_basicCertificate (0.00s)
    resource_aws_pinpoint_apns_voip_channel_test.go:58: Pinpoint certificate credentials envs are missing, skipping test
--- SKIP: TestAccAWSPinpointAPNSVoipChannel_basicToken (0.00s)
    resource_aws_pinpoint_apns_voip_channel_test.go:66: APNS_VOIP_BUNDLE_ID env is missing, skipping test

--- SKIP: TestAccAWSPinpointAPNSVoipSandboxChannel_basicCertificate (0.00s)
    resource_aws_pinpoint_apns_voip_sandbox_channel_test.go:58: Pinpoint certificate credentials envs are missing, skipping test
--- SKIP: TestAccAWSPinpointAPNSVoipSandboxChannel_basicToken (0.00s)
    resource_aws_pinpoint_apns_voip_sandbox_channel_test.go:66: APNS_VOIP_BUNDLE_ID env is missing, skipping test

--- SKIP: TestAccAWSPinpointGCMChannel_basic (0.00s)
    resource_aws_pinpoint_gcm_channel_test.go:26: GCM_API_KEY env missing, skip test

--- PASS: TestAccAWSPinpointApp_basic (18.30s)
--- PASS: TestAccAWSPinpointApp_CampaignHookLambda (51.62s)
--- PASS: TestAccAWSPinpointApp_Limits (16.81s)
--- PASS: TestAccAWSPinpointApp_QuietTime (16.39s)
--- PASS: TestAccAWSPinpointApp_Tags (39.82s)

--- PASS: TestAccAWSPinpointBaiduChannel_basic (27.75s)

--- PASS: TestAccAWSPinpointEmailChannel_basic (31.77s)

--- PASS: TestAccAWSPinpointEventStream_basic (192.97s)

--- PASS: TestAccAWSPinpointSMSChannel_basic (27.71s)
--- PASS: TestAccAWSPinpointSMSChannel_full (29.13s)

--- PASS: TestAccAWSRDSCluster_EncryptedCrossRegionReplication (1593.29s)

--- PASS: TestAccAWSRoute53ZoneAssociation_region (161.54s)

--- PASS: TestAccAWSS3Bucket_region (38.19s)
--- PASS: TestAccAWSS3Bucket_ReplicationExpectVersioningValidationError (28.48s)
--- PASS: TestAccAWSS3Bucket_ReplicationWithoutPrefix (55.65s)
--- PASS: TestAccAWSS3Bucket_ReplicationWithoutStorageClass (56.38s)
--- PASS: TestAccAWSS3Bucket_ReplicationConfiguration_Rule_Destination_AccessControlTranslation (108.97s)
--- PASS: TestAccAWSS3Bucket_ReplicationSchemaV2 (161.13s)
--- PASS: TestAccAWSS3Bucket_Replication (172.15s)
```

In a region where Pinpoint is not supported, all tests continue to skip:

```
--- SKIP: TestAccAWSPinpointApp_basic (27.81s)
    resource_aws_pinpoint_app_test.go:228: skipping acceptance testing: RequestError: send request failed
        caused by: Get https://pinpoint.us-east-2.amazonaws.com/v1/apps: dial tcp: lookup pinpoint.us-east-2.amazonaws.com: no such host
```
@bflad bflad added the technical-debt Addresses areas of the codebase that need refactoring or redesign. label Mar 5, 2020
@bflad bflad requested a review from a team March 5, 2020 19:29
@ghost ghost added needs-triage Waiting for first response or review from a maintainer. size/XXL Managed by automation to categorize the size of a PR. service/codecommit Issues and PRs that pertain to the codecommit service. service/dynamodb Issues and PRs that pertain to the dynamodb service. service/ec2 Issues and PRs that pertain to the ec2 service. service/elasticbeanstalk Issues and PRs that pertain to the elasticbeanstalk service. service/pinpoint Issues and PRs that pertain to the pinpoint service. service/rds Issues and PRs that pertain to the rds service. service/route53 Issues and PRs that pertain to the route53 service. service/s3 Issues and PRs that pertain to the s3 service. tests PRs: expanded test coverage. Issues: expanded coverage, enhancements to test infrastructure. labels Mar 5, 2020
@bflad bflad removed the needs-triage Waiting for first response or review from a maintainer. label Mar 5, 2020
Copy link
Contributor

@gdavison gdavison left a comment

Choose a reason for hiding this comment

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

LGTM 🚀

--- PASS: TestAccAWSDataSourceElasticBeanstalkHostedZone_Region (25.10s)
--- PASS: TestAccAWSDataSourceElasticBeanstalkHostedZone_basic (19.09s)

--- PASS: TestAccAWSAMIFromInstance_basic (411.45s)
--- PASS: TestAccAWSAMIFromInstance_tags (418.03s)

--- PASS: TestAccAWSCodeCommitTrigger_basic (18.76s)

--- PASS: TestAccAWSDynamoDbGlobalTable_basic (62.20s)
--- PASS: TestAccAWSDynamoDbGlobalTable_multipleRegions (108.66s)

--- PASS: TestAccAWSEIP_Instance_Reassociate (68.62s)

--- PASS: TestAccAWSPinpointApp_CampaignHookLambda (36.18s)
--- PASS: TestAccAWSPinpointApp_Limits (9.57s)
--- PASS: TestAccAWSPinpointApp_QuietTime (10.65s)
--- PASS: TestAccAWSPinpointApp_Tags (22.93s)
--- PASS: TestAccAWSPinpointApp_basic (11.27s)

--- SKIP: TestAccAWSPinpointADMChannel_basic (0.00s)

--- SKIP: TestAccAWSPinpointAPNSChannel_basicCertificate (0.00s)
--- SKIP: TestAccAWSPinpointAPNSChannel_basicToken (0.00s)

--- SKIP: TestAccAWSPinpointAPNSSandboxChannel_basicCertificate (0.00s)
--- SKIP: TestAccAWSPinpointAPNSSandboxChannel_basicToken (0.00s)

--- SKIP: TestAccAWSPinpointAPNSVoipChannel_basicCertificate (0.00s)
--- SKIP: TestAccAWSPinpointAPNSVoipChannel_basicToken (0.00s)

--- SKIP: TestAccAWSPinpointAPNSVoipSandboxChannel_basicCertificate (0.00s)
--- SKIP: TestAccAWSPinpointAPNSVoipSandboxChannel_basicToken (0.00s)

--- SKIP: TestAccAWSPinpointGCMChannel_basic (0.00s)

--- PASS: TestAccAWSPinpointBaiduChannel_basic (16.45s)

--- PASS: TestAccAWSPinpointEmailChannel_basic (20.79s)

--- PASS: TestAccAWSPinpointEventStream_basic (139.48s)

--- PASS: TestAccAWSPinpointSMSChannel_basic (17.95s)
--- PASS: TestAccAWSPinpointSMSChannel_full (17.05s)

--- PASS: TestAccAWSRDSCluster_EncryptedCrossRegionReplication (1623.83s)

--- PASS: TestAccAWSRoute53ZoneAssociation_region (170.43s)

--- PASS: TestAccAWSS3Bucket_region (17.63s)
--- PASS: TestAccAWSS3Bucket_ReplicationExpectVersioningValidationError (26.86s)

--- PASS: TestAccAWSS3Bucket_Replication (134.67s)
--- PASS: TestAccAWSS3Bucket_ReplicationConfiguration_Rule_Destination_AccessControlTranslation (89.65s)
--- PASS: TestAccAWSS3Bucket_ReplicationSchemaV2 (111.71s)
--- PASS: TestAccAWSS3Bucket_ReplicationWithoutPrefix (44.74s)
--- PASS: TestAccAWSS3Bucket_ReplicationWithoutStorageClass (41.48s)

@bflad bflad added this to the v2.53.0 milestone Mar 10, 2020
@bflad bflad merged commit 4c275f4 into master Mar 10, 2020
@bflad bflad deleted the t-tfproviderlint-AT004-round-1 branch March 10, 2020 12:52
@ghost
Copy link

ghost commented Mar 12, 2020

This has been released in version 2.53.0 of the Terraform AWS provider. Please see the Terraform documentation on provider versioning or reach out if you need any assistance upgrading.

For further feature requests or bug reports with this functionality, please create a new GitHub issue following the template for triage. Thanks!

@ghost
Copy link

ghost commented Apr 9, 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 9, 2020
Sign up for free to subscribe to this conversation on GitHub. Already have an account? Sign in.
Labels
service/codecommit Issues and PRs that pertain to the codecommit service. service/dynamodb Issues and PRs that pertain to the dynamodb service. service/ec2 Issues and PRs that pertain to the ec2 service. service/elasticbeanstalk Issues and PRs that pertain to the elasticbeanstalk service. service/pinpoint Issues and PRs that pertain to the pinpoint service. service/rds Issues and PRs that pertain to the rds service. service/route53 Issues and PRs that pertain to the route53 service. service/s3 Issues and PRs that pertain to the s3 service. size/XXL Managed by automation to categorize the size of a PR. technical-debt Addresses areas of the codebase that need refactoring or redesign. 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.

None yet

2 participants