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 hardcoded us-west-2 provider declarations in test configurations #9075

Merged
merged 1 commit into from
Jul 10, 2019

Conversation

bflad
Copy link
Contributor

@bflad bflad commented Jun 21, 2019

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" comments, they generate extra noise for pull request followers and do not help prioritize the request

Reference: #8983

Test configurations should omit provider "aws" declarations as these:

  • Prevent the same configuration from successfully running against multiple AWS partitions (e.g. AWS Commercial and AWS GovCloud (US))
  • Reconfigure the default testing provider configuration, which can cause unexpected behavior across multiple tests

In this pass, we cleanup the trivial cases of region = "us-west-2" declarations, which matches the default region the acceptance testing framework is configured. As an added benefit of these changes, some of these tests may begin passing in AWS GovCloud (US) and other partitions. Future updates will handle hardcoded region and availability zone testing.

Previously from tfproviderlint -AT004 ./aws (only relevant failures shown):

aws/data_source_aws_availability_zone_test.go:35:52: AT004: provider declaration should be omitted
aws/data_source_aws_canonical_user_id_test.go:44:51: AT004: provider declaration should be omitted
aws/data_source_aws_kms_ciphertext_test.go:57:55: AT004: provider declaration should be omitted
aws/data_source_aws_kms_ciphertext_test.go:74:58: AT004: provider declaration should be omitted
aws/data_source_aws_kms_ciphertext_test.go:92:70: AT004: provider declaration should be omitted
aws/data_source_aws_nat_gateway_test.go:45:21: AT004: provider declaration should be omitted
aws/data_source_aws_prefix_list_test.go:60:46: AT004: provider declaration should be omitted
aws/data_source_aws_sns_test.go:52:44: AT004: provider declaration should be omitted
aws/data_source_aws_vpc_test.go:134:21: AT004: provider declaration should be omitted
aws/data_source_aws_vpc_test.go:155:21: AT004: provider declaration should be omitted
aws/resource_aws_autoscaling_group_test.go:2481:67: AT004: provider declaration should be omitted
aws/resource_aws_autoscaling_group_test.go:2624:21: AT004: provider declaration should be omitted
aws/resource_aws_default_route_table_test.go:241:41: AT004: provider declaration should be omitted
aws/resource_aws_default_route_table_test.go:291:45: AT004: provider declaration should be omitted
aws/resource_aws_default_route_table_test.go:384:47: AT004: provider declaration should be omitted
aws/resource_aws_default_vpc_test.go:50:41: AT004: provider declaration should be omitted
aws/resource_aws_elb_test.go:1680:37: AT004: provider declaration should be omitted
aws/resource_aws_elb_test.go:1751:41: AT004: provider declaration should be omitted
aws/resource_aws_opsworks_custom_layer_test.go:349:21: AT004: provider declaration should be omitted
aws/resource_aws_opsworks_rails_app_layer_test.go:79:21: AT004: provider declaration should be omitted
aws/resource_aws_opsworks_rails_app_layer_test.go:103:21: AT004: provider declaration should be omitted
aws/resource_aws_opsworks_stack_test.go:726:21: AT004: provider declaration should be omitted
aws/resource_aws_opsworks_stack_test.go:819:21: AT004: provider declaration should be omitted
aws/resource_aws_subnet_test.go:456:47: AT004: provider declaration should be omitted
aws/resource_aws_vpc_endpoint_route_table_association_test.go:105:55: AT004: provider declaration should be omitted

Release note for CHANGELOG:

NONE

Output from acceptance testing in AWS Commercial:

--- PASS: TestAccAWSAutoScalingGroup_ALB_TargetGroups (81.06s)
--- PASS: TestAccAWSAutoScalingGroup_ALB_TargetGroups_ELBCapacity (372.99s)
--- PASS: TestAccAWSDefaultRouteTable_basic (77.18s)
--- PASS: TestAccAWSDefaultRouteTable_Route_TransitGatewayID (314.28s)
--- PASS: TestAccAWSDefaultRouteTable_swap (62.06s)
--- PASS: TestAccAWSDefaultRouteTable_vpc_endpoint (44.30s)
--- PASS: TestAccAWSDefaultVpc_basic (23.95s)
--- PASS: TestAccAWSELB_swap_subnets (74.50s)
--- PASS: TestAccAWSOpsworksCustomLayer_importBasic (42.93s)
--- PASS: TestAccAWSOpsworksRailsAppLayer (59.16s)
--- PASS: TestAccAWSOpsworksStackNoVpcCreateTags (36.37s)
--- PASS: TestAccAWSSubnet_availabilityZoneId (32.60s)
--- PASS: TestAccAWSVpcEndpointRouteTableAssociation_basic (44.86s)
--- PASS: TestAccDataSourceAwsAvailabilityZone (12.31s)
--- PASS: TestAccDataSourceAwsCanonicalUserId_basic (11.20s)
--- PASS: TestAccDataSourceAwsKmsCiphertext_basic (39.08s)
--- PASS: TestAccDataSourceAwsKmsCiphertext_validate (39.13s)
--- PASS: TestAccDataSourceAwsKmsCiphertext_validate_withContext (39.34s)
--- PASS: TestAccDataSourceAwsNatGateway (215.82s)
--- PASS: TestAccDataSourceAwsPrefixList (11.04s)
--- PASS: TestAccDataSourceAwsSnsTopic (14.32s)
--- PASS: TestAccDataSourceAwsVpc_basic (36.01s)
--- PASS: TestAccDataSourceAwsVpc_ipv6Associated (34.89s)
--- PASS: TestAccDataSourceAwsVpc_multipleCidr (53.00s)

…est configurations

Reference: #8983

Test configurations should omit `provider "aws"` declarations as these:

* Prevents the same configuration from successfully running against multiple AWS partitions (e.g. AWS Commercial and AWS GovCloud (US))
* Reconfigure the default testing provider configuration, which can cause unexpected behavior across multiple tests

In this pass, we cleanup the trivial cases of `region = "us-west-2"` declarations, which matches the default region the acceptance testing framework is configured. As an added benefit of these changes, some of these tests may begin passing in AWS GovCloud (US) and other partitions. Future updates will handle hardcoded region and availability zone testing.

Previously from `tfproviderlint -AT004 ./aws` (only relevant failures shown):

```
aws/data_source_aws_availability_zone_test.go:35:52: AT004: provider declaration should be omitted
aws/data_source_aws_canonical_user_id_test.go:44:51: AT004: provider declaration should be omitted
aws/data_source_aws_kms_ciphertext_test.go:57:55: AT004: provider declaration should be omitted
aws/data_source_aws_kms_ciphertext_test.go:74:58: AT004: provider declaration should be omitted
aws/data_source_aws_kms_ciphertext_test.go:92:70: AT004: provider declaration should be omitted
aws/data_source_aws_nat_gateway_test.go:45:21: AT004: provider declaration should be omitted
aws/data_source_aws_prefix_list_test.go:60:46: AT004: provider declaration should be omitted
aws/data_source_aws_sns_test.go:52:44: AT004: provider declaration should be omitted
aws/data_source_aws_vpc_test.go:134:21: AT004: provider declaration should be omitted
aws/data_source_aws_vpc_test.go:155:21: AT004: provider declaration should be omitted
aws/resource_aws_autoscaling_group_test.go:2481:67: AT004: provider declaration should be omitted
aws/resource_aws_autoscaling_group_test.go:2624:21: AT004: provider declaration should be omitted
aws/resource_aws_default_route_table_test.go:241:41: AT004: provider declaration should be omitted
aws/resource_aws_default_route_table_test.go:291:45: AT004: provider declaration should be omitted
aws/resource_aws_default_route_table_test.go:384:47: AT004: provider declaration should be omitted
aws/resource_aws_default_vpc_test.go:50:41: AT004: provider declaration should be omitted
aws/resource_aws_elb_test.go:1680:37: AT004: provider declaration should be omitted
aws/resource_aws_elb_test.go:1751:41: AT004: provider declaration should be omitted
aws/resource_aws_opsworks_custom_layer_test.go:349:21: AT004: provider declaration should be omitted
aws/resource_aws_opsworks_rails_app_layer_test.go:79:21: AT004: provider declaration should be omitted
aws/resource_aws_opsworks_rails_app_layer_test.go:103:21: AT004: provider declaration should be omitted
aws/resource_aws_opsworks_stack_test.go:726:21: AT004: provider declaration should be omitted
aws/resource_aws_opsworks_stack_test.go:819:21: AT004: provider declaration should be omitted
aws/resource_aws_subnet_test.go:456:47: AT004: provider declaration should be omitted
aws/resource_aws_vpc_endpoint_route_table_association_test.go:105:55: AT004: provider declaration should be omitted
```

Output from acceptance testing in AWS Commercial:

```
--- PASS: TestAccAWSAutoScalingGroup_ALB_TargetGroups (81.06s)
--- PASS: TestAccAWSAutoScalingGroup_ALB_TargetGroups_ELBCapacity (372.99s)
--- PASS: TestAccAWSDefaultRouteTable_basic (77.18s)
--- PASS: TestAccAWSDefaultRouteTable_Route_TransitGatewayID (314.28s)
--- PASS: TestAccAWSDefaultRouteTable_swap (62.06s)
--- PASS: TestAccAWSDefaultRouteTable_vpc_endpoint (44.30s)
--- PASS: TestAccAWSDefaultVpc_basic (23.95s)
--- PASS: TestAccAWSELB_swap_subnets (74.50s)
--- PASS: TestAccAWSOpsworksCustomLayer_importBasic (42.93s)
--- PASS: TestAccAWSOpsworksRailsAppLayer (59.16s)
--- PASS: TestAccAWSOpsworksStackNoVpcCreateTags (36.37s)
--- PASS: TestAccAWSSubnet_availabilityZoneId (32.60s)
--- PASS: TestAccAWSVpcEndpointRouteTableAssociation_basic (44.86s)
--- PASS: TestAccDataSourceAwsAvailabilityZone (12.31s)
--- PASS: TestAccDataSourceAwsCanonicalUserId_basic (11.20s)
--- PASS: TestAccDataSourceAwsKmsCiphertext_basic (39.08s)
--- PASS: TestAccDataSourceAwsKmsCiphertext_validate (39.13s)
--- PASS: TestAccDataSourceAwsKmsCiphertext_validate_withContext (39.34s)
--- PASS: TestAccDataSourceAwsNatGateway (215.82s)
--- PASS: TestAccDataSourceAwsPrefixList (11.04s)
--- PASS: TestAccDataSourceAwsSnsTopic (14.32s)
--- PASS: TestAccDataSourceAwsVpc_basic (36.01s)
--- PASS: TestAccDataSourceAwsVpc_ipv6Associated (34.89s)
--- PASS: TestAccDataSourceAwsVpc_multipleCidr (53.00s)
```
@bflad bflad requested a review from a team June 21, 2019 01:12
@ghost ghost added size/M Managed by automation to categorize the size of a PR. service/autoscaling Issues and PRs that pertain to the autoscaling service. service/ec2 Issues and PRs that pertain to the ec2 service. service/elb Issues and PRs that pertain to the elb service. service/kms Issues and PRs that pertain to the kms service. service/opsworks Issues and PRs that pertain to the opsworks service. service/s3 Issues and PRs that pertain to the s3 service. service/sns Issues and PRs that pertain to the sns service. tests PRs: expanded test coverage. Issues: expanded coverage, enhancements to test infrastructure. labels Jun 21, 2019
@nywilken
Copy link
Contributor

Nice first past 👍

@nywilken nywilken added this to the v2.19.0 milestone Jul 10, 2019
@nywilken nywilken merged commit 29c41d7 into master Jul 10, 2019
@nywilken nywilken deleted the td-tfproviderlint-AT004-us-west-2 branch July 10, 2019 18:41
@ghost
Copy link

ghost commented Nov 2, 2019

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 Nov 2, 2019
Sign up for free to subscribe to this conversation on GitHub. Already have an account? Sign in.
Labels
service/autoscaling Issues and PRs that pertain to the autoscaling service. service/ec2 Issues and PRs that pertain to the ec2 service. service/elb Issues and PRs that pertain to the elb service. service/kms Issues and PRs that pertain to the kms service. service/opsworks Issues and PRs that pertain to the opsworks service. service/s3 Issues and PRs that pertain to the s3 service. service/sns Issues and PRs that pertain to the sns service. size/M 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