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

r/aws_default_route_table: Refactor acceptance tests in preparation for future fixes/enhancements #14012

Merged

Conversation

ewbankkit
Copy link
Contributor

@ewbankkit ewbankkit commented Jul 1, 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

Refactoring aws_default_route_table resource acceptance tests in preparation for future fixes/enhancements.
Relates #13527.

Release note for CHANGELOG:

NONE

Output from acceptance testing:

$ make testacc TEST=./aws/ TESTARGS='-run=TestAccAWSDefaultRouteTable_'
==> Checking that code complies with gofmt requirements...
TF_ACC=1 go test ./aws/ -v -count 1 -parallel 2 -run=TestAccAWSDefaultRouteTable_ -timeout 120m
=== RUN   TestAccAWSDefaultRouteTable_basic
=== PAUSE TestAccAWSDefaultRouteTable_basic
=== RUN   TestAccAWSDefaultRouteTable_vpcDisappears
=== PAUSE TestAccAWSDefaultRouteTable_vpcDisappears
=== RUN   TestAccAWSDefaultRouteTable_Route_ConfigMode
=== PAUSE TestAccAWSDefaultRouteTable_Route_ConfigMode
=== RUN   TestAccAWSDefaultRouteTable_swap
=== PAUSE TestAccAWSDefaultRouteTable_swap
=== RUN   TestAccAWSDefaultRouteTable_IPv4_To_TransitGateway
=== PAUSE TestAccAWSDefaultRouteTable_IPv4_To_TransitGateway
=== RUN   TestAccAWSDefaultRouteTable_VpcEndpointAssociation
=== PAUSE TestAccAWSDefaultRouteTable_VpcEndpointAssociation
=== RUN   TestAccAWSDefaultRouteTable_tags
=== PAUSE TestAccAWSDefaultRouteTable_tags
=== RUN   TestAccAWSDefaultRouteTable_ConditionalCidrBlock
=== PAUSE TestAccAWSDefaultRouteTable_ConditionalCidrBlock
=== CONT  TestAccAWSDefaultRouteTable_basic
=== CONT  TestAccAWSDefaultRouteTable_IPv4_To_TransitGateway
--- PASS: TestAccAWSDefaultRouteTable_basic (53.09s)
=== CONT  TestAccAWSDefaultRouteTable_ConditionalCidrBlock
--- PASS: TestAccAWSDefaultRouteTable_ConditionalCidrBlock (78.73s)
=== CONT  TestAccAWSDefaultRouteTable_tags
--- PASS: TestAccAWSDefaultRouteTable_tags (82.10s)
=== CONT  TestAccAWSDefaultRouteTable_VpcEndpointAssociation
--- PASS: TestAccAWSDefaultRouteTable_VpcEndpointAssociation (58.35s)
=== CONT  TestAccAWSDefaultRouteTable_Route_ConfigMode
--- PASS: TestAccAWSDefaultRouteTable_IPv4_To_TransitGateway (318.88s)
=== CONT  TestAccAWSDefaultRouteTable_swap
--- PASS: TestAccAWSDefaultRouteTable_Route_ConfigMode (99.49s)
=== CONT  TestAccAWSDefaultRouteTable_vpcDisappears
--- PASS: TestAccAWSDefaultRouteTable_vpcDisappears (24.11s)
--- PASS: TestAccAWSDefaultRouteTable_swap (106.31s)
PASS
ok  	github.com/terraform-providers/terraform-provider-aws/aws	425.257s

@ewbankkit ewbankkit requested a review from a team July 1, 2020 14:43
@ghost ghost added size/XL Managed by automation to categorize the size of a PR. service/ec2 Issues and PRs that pertain to the ec2 service. tests PRs: expanded test coverage. Issues: expanded coverage, enhancements to test infrastructure. labels Jul 1, 2020
@@ -555,6 +555,16 @@ func TestAccAWSRouteTable_ConditionalCidrBlock(t *testing.T) {
})
}

func testAccCheckAWSRouteTableNumberOfRoutes(routeTable *ec2.RouteTable, n int) resource.TestCheckFunc {
Copy link
Contributor Author

Choose a reason for hiding this comment

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

Shared with #14013.

Copy link
Contributor

Choose a reason for hiding this comment

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

We should try to move away from API object TestCheckFunc like these in preference of state value and ImportStateVerify checks -- please see: #16435

Copy link
Contributor Author

Choose a reason for hiding this comment

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

In general I completely agree that those kind of checkers aren't desirable, in this case I am verifying that the number of routes returned by the API is NOT equal to the number of routes stored in state:

testAccCheckAWSRouteTableNumberOfRoutes(&routeTable, 2),
resource.TestCheckResourceAttr(resourceName, "route.#", "1"),

effectively testing the validity of this code:

for _, r := range rt.Routes {
if aws.StringValue(r.GatewayId) == "local" {
continue
}
if aws.StringValue(r.Origin) == ec2.RouteOriginEnableVgwRoutePropagation {
continue
}
if r.DestinationPrefixListId != nil {
// Skipping because VPC endpoint routes are handled separately
// See aws_vpc_endpoint
continue
}

Copy link
Contributor Author

Choose a reason for hiding this comment

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

Happy to remove if you think this is overkill.

@ewbankkit ewbankkit force-pushed the t-additional-aws_default_route_table-tests branch from 9a350bf to f242945 Compare August 8, 2020 21:41
@ewbankkit
Copy link
Contributor Author

Rebased to fix merge conflicts.
Re-ran acceptance tests:

$ make testacc TEST=./aws/ TESTARGS='-run=TestAccAWSDefaultRouteTable_'
==> Checking that code complies with gofmt requirements...
TF_ACC=1 go test ./aws -v -count 1 -parallel 2 -run=TestAccAWSDefaultRouteTable_ -timeout 120m
=== RUN   TestAccAWSDefaultRouteTable_basic
=== PAUSE TestAccAWSDefaultRouteTable_basic
=== RUN   TestAccAWSDefaultRouteTable_vpcDisappears
=== PAUSE TestAccAWSDefaultRouteTable_vpcDisappears
=== RUN   TestAccAWSDefaultRouteTable_Route_ConfigMode
=== PAUSE TestAccAWSDefaultRouteTable_Route_ConfigMode
=== RUN   TestAccAWSDefaultRouteTable_swap
=== PAUSE TestAccAWSDefaultRouteTable_swap
=== RUN   TestAccAWSDefaultRouteTable_IPv4_To_TransitGateway
=== PAUSE TestAccAWSDefaultRouteTable_IPv4_To_TransitGateway
=== RUN   TestAccAWSDefaultRouteTable_VpcEndpointAssociation
=== PAUSE TestAccAWSDefaultRouteTable_VpcEndpointAssociation
=== RUN   TestAccAWSDefaultRouteTable_tags
=== PAUSE TestAccAWSDefaultRouteTable_tags
=== RUN   TestAccAWSDefaultRouteTable_ConditionalCidrBlock
=== PAUSE TestAccAWSDefaultRouteTable_ConditionalCidrBlock
=== CONT  TestAccAWSDefaultRouteTable_basic
=== CONT  TestAccAWSDefaultRouteTable_VpcEndpointAssociation
--- PASS: TestAccAWSDefaultRouteTable_basic (33.27s)
=== CONT  TestAccAWSDefaultRouteTable_IPv4_To_TransitGateway
--- PASS: TestAccAWSDefaultRouteTable_VpcEndpointAssociation (45.59s)
=== CONT  TestAccAWSDefaultRouteTable_swap
--- PASS: TestAccAWSDefaultRouteTable_swap (80.37s)
=== CONT  TestAccAWSDefaultRouteTable_Route_ConfigMode
--- PASS: TestAccAWSDefaultRouteTable_Route_ConfigMode (70.97s)
=== CONT  TestAccAWSDefaultRouteTable_vpcDisappears
--- PASS: TestAccAWSDefaultRouteTable_vpcDisappears (14.60s)
=== CONT  TestAccAWSDefaultRouteTable_ConditionalCidrBlock
--- PASS: TestAccAWSDefaultRouteTable_ConditionalCidrBlock (57.40s)
=== CONT  TestAccAWSDefaultRouteTable_tags
--- PASS: TestAccAWSDefaultRouteTable_tags (54.05s)
--- PASS: TestAccAWSDefaultRouteTable_IPv4_To_TransitGateway (312.77s)
PASS
ok  	github.com/terraform-providers/terraform-provider-aws/aws	346.094s

@ewbankkit ewbankkit force-pushed the t-additional-aws_default_route_table-tests branch from 4870ce6 to 5e219c6 Compare August 22, 2020 21:13
@ewbankkit
Copy link
Contributor Author

Rebased and re-ran acceptance tests:

$ make testacc TEST=./aws/ TESTARGS='-run=TestAccAWSDefaultRouteTable_' ACCTEST_PARALLELISM=2
==> Checking that code complies with gofmt requirements...
TF_ACC=1 go test ./aws -v -count 1 -parallel 2 -run=TestAccAWSDefaultRouteTable_ -timeout 120m
=== RUN   TestAccAWSDefaultRouteTable_basic
=== PAUSE TestAccAWSDefaultRouteTable_basic
=== RUN   TestAccAWSDefaultRouteTable_vpcDisappears
=== PAUSE TestAccAWSDefaultRouteTable_vpcDisappears
=== RUN   TestAccAWSDefaultRouteTable_Route_ConfigMode
=== PAUSE TestAccAWSDefaultRouteTable_Route_ConfigMode
=== RUN   TestAccAWSDefaultRouteTable_swap
=== PAUSE TestAccAWSDefaultRouteTable_swap
=== RUN   TestAccAWSDefaultRouteTable_IPv4_To_TransitGateway
=== PAUSE TestAccAWSDefaultRouteTable_IPv4_To_TransitGateway
=== RUN   TestAccAWSDefaultRouteTable_VpcEndpointAssociation
=== PAUSE TestAccAWSDefaultRouteTable_VpcEndpointAssociation
=== RUN   TestAccAWSDefaultRouteTable_tags
=== PAUSE TestAccAWSDefaultRouteTable_tags
=== RUN   TestAccAWSDefaultRouteTable_ConditionalCidrBlock
=== PAUSE TestAccAWSDefaultRouteTable_ConditionalCidrBlock
=== CONT  TestAccAWSDefaultRouteTable_basic
=== CONT  TestAccAWSDefaultRouteTable_VpcEndpointAssociation
--- PASS: TestAccAWSDefaultRouteTable_basic (35.00s)
=== CONT  TestAccAWSDefaultRouteTable_ConditionalCidrBlock
--- PASS: TestAccAWSDefaultRouteTable_VpcEndpointAssociation (49.83s)
=== CONT  TestAccAWSDefaultRouteTable_tags
--- PASS: TestAccAWSDefaultRouteTable_ConditionalCidrBlock (61.75s)
=== CONT  TestAccAWSDefaultRouteTable_swap
--- PASS: TestAccAWSDefaultRouteTable_tags (61.74s)
=== CONT  TestAccAWSDefaultRouteTable_IPv4_To_TransitGateway
=== CONT  TestAccAWSDefaultRouteTable_swap
    resource_aws_default_route_table_test.go:157: [INFO] Got non-empty plan, as expected
    resource_aws_default_route_table_test.go:157: [INFO] Got non-empty plan, as expected
--- PASS: TestAccAWSDefaultRouteTable_swap (101.30s)
=== CONT  TestAccAWSDefaultRouteTable_Route_ConfigMode
--- PASS: TestAccAWSDefaultRouteTable_Route_ConfigMode (93.59s)
=== CONT  TestAccAWSDefaultRouteTable_vpcDisappears
    resource_aws_default_route_table_test.go:65: [INFO] Got non-empty plan, as expected
--- PASS: TestAccAWSDefaultRouteTable_vpcDisappears (17.29s)
--- PASS: TestAccAWSDefaultRouteTable_IPv4_To_TransitGateway (312.03s)
PASS
ok  	github.com/terraform-providers/terraform-provider-aws/aws	423.645s

@ewbankkit

This comment has been minimized.

@ewbankkit ewbankkit force-pushed the t-additional-aws_default_route_table-tests branch from 5e219c6 to 8de05b8 Compare September 4, 2020 16:26
@ewbankkit ewbankkit force-pushed the t-additional-aws_default_route_table-tests branch from 8de05b8 to 178bc40 Compare September 22, 2020 20:29
@ewbankkit
Copy link
Contributor Author

Rebased and fixed merge conflict.
Re-ran acceptance tests:

$ make testacc TEST=./aws/ TESTARGS='-run=TestAccAWSDefaultRouteTable_' ACCTEST_PARALLELISM=2
==> Checking that code complies with gofmt requirements...
TF_ACC=1 go test ./aws -v -count 1 -parallel 2 -run=TestAccAWSDefaultRouteTable_ -timeout 120m
=== RUN   TestAccAWSDefaultRouteTable_basic
=== PAUSE TestAccAWSDefaultRouteTable_basic
=== RUN   TestAccAWSDefaultRouteTable_vpcDisappears
=== PAUSE TestAccAWSDefaultRouteTable_vpcDisappears
=== RUN   TestAccAWSDefaultRouteTable_Route_ConfigMode
=== PAUSE TestAccAWSDefaultRouteTable_Route_ConfigMode
=== RUN   TestAccAWSDefaultRouteTable_swap
=== PAUSE TestAccAWSDefaultRouteTable_swap
=== RUN   TestAccAWSDefaultRouteTable_IPv4_To_TransitGateway
=== PAUSE TestAccAWSDefaultRouteTable_IPv4_To_TransitGateway
=== RUN   TestAccAWSDefaultRouteTable_VpcEndpointAssociation
=== PAUSE TestAccAWSDefaultRouteTable_VpcEndpointAssociation
=== RUN   TestAccAWSDefaultRouteTable_tags
=== PAUSE TestAccAWSDefaultRouteTable_tags
=== RUN   TestAccAWSDefaultRouteTable_ConditionalCidrBlock
=== PAUSE TestAccAWSDefaultRouteTable_ConditionalCidrBlock
=== CONT  TestAccAWSDefaultRouteTable_basic
=== CONT  TestAccAWSDefaultRouteTable_VpcEndpointAssociation
--- PASS: TestAccAWSDefaultRouteTable_basic (36.82s)
=== CONT  TestAccAWSDefaultRouteTable_ConditionalCidrBlock
--- PASS: TestAccAWSDefaultRouteTable_VpcEndpointAssociation (49.81s)
=== CONT  TestAccAWSDefaultRouteTable_tags
--- PASS: TestAccAWSDefaultRouteTable_ConditionalCidrBlock (64.67s)
=== CONT  TestAccAWSDefaultRouteTable_swap
--- PASS: TestAccAWSDefaultRouteTable_tags (65.13s)
=== CONT  TestAccAWSDefaultRouteTable_IPv4_To_TransitGateway
=== CONT  TestAccAWSDefaultRouteTable_swap
    resource_aws_default_route_table_test.go:157: [INFO] Got non-empty plan, as expected
    resource_aws_default_route_table_test.go:157: [INFO] Got non-empty plan, as expected
--- PASS: TestAccAWSDefaultRouteTable_swap (103.82s)
=== CONT  TestAccAWSDefaultRouteTable_Route_ConfigMode
--- PASS: TestAccAWSDefaultRouteTable_Route_ConfigMode (96.16s)
=== CONT  TestAccAWSDefaultRouteTable_vpcDisappears
    resource_aws_default_route_table_test.go:65: [INFO] Got non-empty plan, as expected
--- PASS: TestAccAWSDefaultRouteTable_vpcDisappears (17.55s)
--- PASS: TestAccAWSDefaultRouteTable_IPv4_To_TransitGateway (323.51s)
PASS
ok  	github.com/terraform-providers/terraform-provider-aws/aws	438.504s

@ewbankkit ewbankkit force-pushed the t-additional-aws_default_route_table-tests branch from 178bc40 to ac4f076 Compare October 5, 2020 17:00
Copy link
Collaborator

@DrFaust92 DrFaust92 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: TestAccAWSDefaultRouteTable_basic (78.56s)
--- PASS: TestAccAWSDefaultRouteTable_VpcEndpointAssociation (92.45s)
--- PASS: TestAccAWSDefaultRouteTable_ConditionalCidrBlock (126.06s)
--- PASS: TestAccAWSDefaultRouteTable_tags (142.06s)
--- PASS: TestAccAWSDefaultRouteTable_vpcDisappears (38.37s)
--- PASS: TestAccAWSDefaultRouteTable_swap (221.18s)
--- PASS: TestAccAWSDefaultRouteTable_Route_ConfigMode (205.23s)
--- PASS: TestAccAWSDefaultRouteTable_IPv4_To_TransitGateway (444.63s)

@ewbankkit ewbankkit force-pushed the t-additional-aws_default_route_table-tests branch from ac4f076 to 38e0b5d Compare November 15, 2020 00:29
@ewbankkit ewbankkit requested a review from a team as a code owner November 15, 2020 00:29
@ewbankkit
Copy link
Contributor Author

ewbankkit commented Nov 15, 2020

When I run the full set of acceptance tests I get:

TF_ACC=1 go test ./aws -v -count 1 -parallel 2 -run=TestAccAWSDefaultRouteTable_ -timeout 120m
=== RUN   TestAccAWSDefaultRouteTable_basic
=== PAUSE TestAccAWSDefaultRouteTable_basic
=== RUN   TestAccAWSDefaultRouteTable_vpcDisappears
=== PAUSE TestAccAWSDefaultRouteTable_vpcDisappears
=== RUN   TestAccAWSDefaultRouteTable_Route_ConfigMode
=== PAUSE TestAccAWSDefaultRouteTable_Route_ConfigMode
=== RUN   TestAccAWSDefaultRouteTable_swap
=== PAUSE TestAccAWSDefaultRouteTable_swap
=== RUN   TestAccAWSDefaultRouteTable_IPv4_To_TransitGateway
=== PAUSE TestAccAWSDefaultRouteTable_IPv4_To_TransitGateway
=== RUN   TestAccAWSDefaultRouteTable_IPv4_To_VpcEndpoint
=== PAUSE TestAccAWSDefaultRouteTable_IPv4_To_VpcEndpoint
=== RUN   TestAccAWSDefaultRouteTable_VpcEndpointAssociation
=== PAUSE TestAccAWSDefaultRouteTable_VpcEndpointAssociation
=== RUN   TestAccAWSDefaultRouteTable_tags
=== PAUSE TestAccAWSDefaultRouteTable_tags
=== RUN   TestAccAWSDefaultRouteTable_ConditionalCidrBlock
=== PAUSE TestAccAWSDefaultRouteTable_ConditionalCidrBlock
=== CONT  TestAccAWSDefaultRouteTable_basic
=== CONT  TestAccAWSDefaultRouteTable_ConditionalCidrBlock
=== CONT  TestAccAWSDefaultRouteTable_tags
--- PASS: TestAccAWSDefaultRouteTable_basic (30.21s)
--- PASS: TestAccAWSDefaultRouteTable_ConditionalCidrBlock (54.98s)
=== CONT  TestAccAWSDefaultRouteTable_VpcEndpointAssociation
--- PASS: TestAccAWSDefaultRouteTable_tags (52.97s)
=== CONT  TestAccAWSDefaultRouteTable_IPv4_To_VpcEndpoint
--- PASS: TestAccAWSDefaultRouteTable_VpcEndpointAssociation (43.83s)
=== CONT  TestAccAWSDefaultRouteTable_IPv4_To_TransitGateway
=== CONT  TestAccAWSDefaultRouteTable_IPv4_To_VpcEndpoint
--- FAIL: TestAccAWSDefaultRouteTable_IPv4_To_VpcEndpoint (117.63s)
=== CONT  TestAccAWSDefaultRouteTable_swap
--- PASS: TestAccAWSDefaultRouteTable_swap (89.43s)
=== CONT  TestAccAWSDefaultRouteTable_Route_ConfigMode
--- PASS: TestAccAWSDefaultRouteTable_Route_ConfigMode (83.12s)
=== CONT  TestAccAWSDefaultRouteTable_vpcDisappears
--- PASS: TestAccAWSDefaultRouteTable_vpcDisappears (14.14s)
--- PASS: TestAccAWSDefaultRouteTable_IPv4_To_TransitGateway (359.22s)

with

2020/11/14 19:32:25 [DEBUG] Creating VPC Endpoint: {
  PrivateDnsEnabled: false,
  ServiceName: "com.amazonaws.vpce.us-west-2.vpce-svc-034a263c13b0f990a",
  SubnetIds: ["subnet-0c91a9b004cb683ac"],
  TagSpecifications: [{
      ResourceType: "vpc-endpoint",
      Tags: [{
          Key: "Name",
          Value: "tf-acc-test-2618315836476580278"
        }]
    }],
  VpcEndpointType: "GatewayLoadBalancer",
  VpcId: "vpc-0f2c572c3aa22af5f"
}
2020/11/14 19:32:26 [DEBUG] [aws-sdk-go] DEBUG: Response ec2/CreateVpcEndpoint Details:
---[ RESPONSE ]--------------------------------------
HTTP/1.1 200 OK
Connection: close
Transfer-Encoding: chunked
Content-Type: text/xml;charset=UTF-8
Date: Sun, 15 Nov 2020 00:32:25 GMT
Server: AmazonEC2
Vary: accept-encoding
X-Amzn-Requestid: c7d1fc18-8d0a-402c-89bf-4ed500e33719


-----------------------------------------------------
2020/11/14 19:32:26 [DEBUG] [aws-sdk-go] <?xml version="1.0" encoding="UTF-8"?>
<CreateVpcEndpointResponse xmlns="http://ec2.amazonaws.com/doc/2016-11-15/">
    <requestId>c7d1fc18-8d0a-402c-89bf-4ed500e33719</requestId>
    <vpcEndpoint>
        <creationTimestamp>2020-11-15T00:32:25.432Z</creationTimestamp>
        <networkInterfaceIdSet>
            <item>eni-031c3cfa9bfbb03ae</item>
        </networkInterfaceIdSet>
        <ownerId>123456789012</ownerId>
        <requesterManaged>false</requesterManaged>
        <serviceName>com.amazonaws.vpce.us-west-2.vpce-svc-034a263c13b0f990a</serviceName>
        <state>pending</state>
        <subnetIdSet>
            <item>subnet-0c91a9b004cb683ac</item>
        </subnetIdSet>
        <tagSet>
            <item>
                <key>Name</key>
                <value>tf-acc-test-2618315836476580278</value>
            </item>
        </tagSet>
        <vpcEndpointId>vpce-0f812974e9f2a0856</vpcEndpointId>
        <vpcEndpointType>GatewayLoadBalancer</vpcEndpointType>
        <vpcId>vpc-0f2c572c3aa22af5f</vpcId>
    </vpcEndpoint>
</CreateVpcEndpointResponse>
2020/11/14 19:32:26 [DEBUG] Waiting for state to become: [available pendingAcceptance]
2020/11/14 19:32:31 [DEBUG] Reading VPC Endpoint: vpce-0f812974e9f2a0856
2020/11/14 19:32:31 [DEBUG] [aws-sdk-go] DEBUG: Response ec2/DescribeVpcEndpoints Details:
---[ RESPONSE ]--------------------------------------
HTTP/1.1 200 OK
Connection: close
Transfer-Encoding: chunked
Content-Type: text/xml;charset=UTF-8
Date: Sun, 15 Nov 2020 00:32:30 GMT
Server: AmazonEC2
Vary: accept-encoding
X-Amzn-Requestid: 532533b9-d2d0-4327-a6be-8f90d9fae4cd


-----------------------------------------------------
2020/11/14 19:32:31 [DEBUG] [aws-sdk-go] <?xml version="1.0" encoding="UTF-8"?>
<DescribeVpcEndpointsResponse xmlns="http://ec2.amazonaws.com/doc/2016-11-15/">
    <requestId>532533b9-d2d0-4327-a6be-8f90d9fae4cd</requestId>
    <vpcEndpointSet>
        <item>
            <creationTimestamp>2020-11-15T00:32:25.432Z</creationTimestamp>
            <lastError>
                <code>AttachInterfaceUnauthorized</code>
                <message>VPC endpoint vpce-0f812974e9f2a0856 is still provisioning.</message>
            </lastError>
            <networkInterfaceIdSet>
                <item>eni-031c3cfa9bfbb03ae</item>
            </networkInterfaceIdSet>
            <ownerId>123456789012</ownerId>
            <requesterManaged>false</requesterManaged>
            <serviceName>com.amazonaws.vpce.us-west-2.vpce-svc-034a263c13b0f990a</serviceName>
            <state>failed</state>
            <subnetIdSet>
                <item>subnet-0c91a9b004cb683ac</item>
            </subnetIdSet>
            <tagSet>
                <item>
                    <key>Name</key>
                    <value>tf-acc-test-2618315836476580278</value>
                </item>
            </tagSet>
            <vpcEndpointId>vpce-0f812974e9f2a0856</vpcEndpointId>
            <vpcEndpointType>GatewayLoadBalancer</vpcEndpointType>
            <vpcId>vpc-0f2c572c3aa22af5f</vpcId>
        </item>
    </vpcEndpointSet>
</DescribeVpcEndpointsResponse>
2020/11/14 19:32:31 [WARN] Got error running Terraform: 2020/11/14 19:31:07 [DEBUG] Using modified User-Agent: Terraform/0.12.26 HashiCorp-terraform-exec/0.10.0

Error: error waiting for VPC Endpoint (vpce-0f812974e9f2a0856) to become available: VPC Endpoint is in a failed state

… and 'TestAccAWSDefaultRouteTable_disappears_Vpc'.

Acceptance test output:

$ make testacc TEST=./aws/ TESTARGS='-run=TestAccAWSDefaultRouteTable_basic'
==> Checking that code complies with gofmt requirements...
TF_ACC=1 go test ./aws/ -v -count 1 -parallel 20 -run=TestAccAWSDefaultRouteTable_basic -timeout 120m
=== RUN   TestAccAWSDefaultRouteTable_basic
=== PAUSE TestAccAWSDefaultRouteTable_basic
=== CONT  TestAccAWSDefaultRouteTable_basic
--- PASS: TestAccAWSDefaultRouteTable_basic (53.01s)
PASS
ok  	github.com/terraform-providers/terraform-provider-aws/aws	53.064s
$ make testacc TEST=./aws/ TESTARGS='-run=TestAccAWSDefaultRouteTable_disappears_Vpc'
==> Checking that code complies with gofmt requirements...
TF_ACC=1 go test ./aws/ -v -count 1 -parallel 20 -run=TestAccAWSDefaultRouteTable_disappears_Vpc -timeout 120m
=== RUN   TestAccAWSDefaultRouteTable_disappears_Vpc
=== PAUSE TestAccAWSDefaultRouteTable_disappears_Vpc
=== CONT  TestAccAWSDefaultRouteTable_disappears_Vpc
--- PASS: TestAccAWSDefaultRouteTable_disappears_Vpc (24.54s)
PASS
ok  	github.com/terraform-providers/terraform-provider-aws/aws	24.591s
… to 'TestAccAWSDefaultRouteTable_Route_ConfigMode' to match r/aws_route_table.

Acceptance test output:

$ make testacc TEST=./aws/ TESTARGS='-run=TestAccAWSDefaultRouteTable_Route_ConfigMode'
==> Checking that code complies with gofmt requirements...
TF_ACC=1 go test ./aws/ -v -count 1 -parallel 20 -run=TestAccAWSDefaultRouteTable_Route_ConfigMode -timeout 120m
=== RUN   TestAccAWSDefaultRouteTable_Route_ConfigMode
=== PAUSE TestAccAWSDefaultRouteTable_Route_ConfigMode
=== CONT  TestAccAWSDefaultRouteTable_Route_ConfigMode
--- PASS: TestAccAWSDefaultRouteTable_Route_ConfigMode (102.58s)
PASS
ok  	github.com/terraform-providers/terraform-provider-aws/aws	102.647s
Acceptance test output:

$ make testacc TEST=./aws/ TESTARGS='-run=TestAccAWSDefaultRouteTable_swap'
==> Checking that code complies with gofmt requirements...
TF_ACC=1 go test ./aws/ -v -count 1 -parallel 20 -run=TestAccAWSDefaultRouteTable_swap -timeout 120m
=== RUN   TestAccAWSDefaultRouteTable_swap
=== PAUSE TestAccAWSDefaultRouteTable_swap
=== CONT  TestAccAWSDefaultRouteTable_swap
--- PASS: TestAccAWSDefaultRouteTable_swap (109.41s)
PASS
ok  	github.com/terraform-providers/terraform-provider-aws/aws	109.499s
…c' -> 'TestAccAWSDefaultRouteTable_vpcDisappears'.
…ionalCidrBlock'.

Acceptance test output:

$ make testacc TEST=./aws/ TESTARGS='-run=TestAccAWSDefaultRouteTable_ConditionalCidrBlock'
==> Checking that code complies with gofmt requirements...
TF_ACC=1 go test ./aws/ -v -count 1 -parallel 20 -run=TestAccAWSDefaultRouteTable_ConditionalCidrBlock -timeout 120m
=== RUN   TestAccAWSDefaultRouteTable_ConditionalCidrBlock
=== PAUSE TestAccAWSDefaultRouteTable_ConditionalCidrBlock
=== CONT  TestAccAWSDefaultRouteTable_ConditionalCidrBlock
--- PASS: TestAccAWSDefaultRouteTable_ConditionalCidrBlock (79.63s)
PASS
ok  	github.com/terraform-providers/terraform-provider-aws/aws	80.192s
…dpoint' to 'TestAccAWSDefaultRouteTable_VpcEndpointAssociation'.

Acceptance test output:

$ make testacc TEST=./aws/ TESTARGS='-run=TestAccAWSDefaultRouteTable_VpcEndpointAssociation'
==> Checking that code complies with gofmt requirements...
TF_ACC=1 go test ./aws/ -v -count 1 -parallel 20 -run=TestAccAWSDefaultRouteTable_VpcEndpointAssociation -timeout 120m
=== RUN   TestAccAWSDefaultRouteTable_VpcEndpointAssociation
=== PAUSE TestAccAWSDefaultRouteTable_VpcEndpointAssociation
=== CONT  TestAccAWSDefaultRouteTable_VpcEndpointAssociation
--- PASS: TestAccAWSDefaultRouteTable_VpcEndpointAssociation (57.87s)
PASS
ok  	github.com/terraform-providers/terraform-provider-aws/aws	57.930s
…TransitGatewayID' to 'TestAccAWSDefaultRouteTable_IPv4_To_TransitGateway'.

Acceptance test output:

$ make testacc TEST=./aws/ TESTARGS='-run=TestAccAWSDefaultRouteTable_IPv4_To_TransitGateway'
==> Checking that code complies with gofmt requirements...
TF_ACC=1 go test ./aws/ -v -count 1 -parallel 20 -run=TestAccAWSDefaultRouteTable_IPv4_To_TransitGateway -timeout 120m
=== RUN   TestAccAWSDefaultRouteTable_IPv4_To_TransitGateway
=== PAUSE TestAccAWSDefaultRouteTable_IPv4_To_TransitGateway
=== CONT  TestAccAWSDefaultRouteTable_IPv4_To_TransitGateway
--- PASS: TestAccAWSDefaultRouteTable_IPv4_To_TransitGateway (317.38s)
PASS
ok  	github.com/terraform-providers/terraform-provider-aws/aws	317.429s
@ewbankkit ewbankkit force-pushed the t-additional-aws_default_route_table-tests branch from 38e0b5d to fc00866 Compare November 30, 2020 16:07
@ewbankkit
Copy link
Contributor Author

Rebased and fixed merge conflicts.

$ make testacc TEST=./aws/ TESTARGS='-run=TestAccAWSDefaultRouteTable_' ACCTEST_PARALLELISM=2
==> Checking that code complies with gofmt requirements...
TF_ACC=1 go test ./aws -v -count 1 -parallel 2 -run=TestAccAWSDefaultRouteTable_ -timeout 120m
=== RUN   TestAccAWSDefaultRouteTable_basic
=== PAUSE TestAccAWSDefaultRouteTable_basic
=== RUN   TestAccAWSDefaultRouteTable_vpcDisappears
=== PAUSE TestAccAWSDefaultRouteTable_vpcDisappears
=== RUN   TestAccAWSDefaultRouteTable_Route_ConfigMode
=== PAUSE TestAccAWSDefaultRouteTable_Route_ConfigMode
=== RUN   TestAccAWSDefaultRouteTable_swap
=== PAUSE TestAccAWSDefaultRouteTable_swap
=== RUN   TestAccAWSDefaultRouteTable_IPv4_To_TransitGateway
=== PAUSE TestAccAWSDefaultRouteTable_IPv4_To_TransitGateway
=== RUN   TestAccAWSDefaultRouteTable_IPv4_To_VpcEndpoint
=== PAUSE TestAccAWSDefaultRouteTable_IPv4_To_VpcEndpoint
=== RUN   TestAccAWSDefaultRouteTable_VpcEndpointAssociation
=== PAUSE TestAccAWSDefaultRouteTable_VpcEndpointAssociation
=== RUN   TestAccAWSDefaultRouteTable_tags
=== PAUSE TestAccAWSDefaultRouteTable_tags
=== RUN   TestAccAWSDefaultRouteTable_ConditionalCidrBlock
=== PAUSE TestAccAWSDefaultRouteTable_ConditionalCidrBlock
=== CONT  TestAccAWSDefaultRouteTable_basic
=== CONT  TestAccAWSDefaultRouteTable_ConditionalCidrBlock
--- PASS: TestAccAWSDefaultRouteTable_basic (30.06s)
=== CONT  TestAccAWSDefaultRouteTable_tags
--- PASS: TestAccAWSDefaultRouteTable_ConditionalCidrBlock (55.68s)
=== CONT  TestAccAWSDefaultRouteTable_VpcEndpointAssociation
--- PASS: TestAccAWSDefaultRouteTable_tags (53.46s)
=== CONT  TestAccAWSDefaultRouteTable_IPv4_To_VpcEndpoint
=== CONT  TestAccAWSDefaultRouteTable_IPv4_To_TransitGateway
--- PASS: TestAccAWSDefaultRouteTable_VpcEndpointAssociation (46.09s)
--- PASS: TestAccAWSDefaultRouteTable_IPv4_To_VpcEndpoint (307.68s)
=== CONT  TestAccAWSDefaultRouteTable_swap
--- PASS: TestAccAWSDefaultRouteTable_IPv4_To_TransitGateway (327.46s)
=== CONT  TestAccAWSDefaultRouteTable_Route_ConfigMode
--- PASS: TestAccAWSDefaultRouteTable_swap (90.87s)
=== CONT  TestAccAWSDefaultRouteTable_vpcDisappears
--- PASS: TestAccAWSDefaultRouteTable_vpcDisappears (14.19s)
--- PASS: TestAccAWSDefaultRouteTable_Route_ConfigMode (84.58s)
PASS
ok  	github.com/terraform-providers/terraform-provider-aws/aws	513.872s

aws/resource_aws_default_route_table_test.go Outdated Show resolved Hide resolved
@@ -555,6 +555,16 @@ func TestAccAWSRouteTable_ConditionalCidrBlock(t *testing.T) {
})
}

func testAccCheckAWSRouteTableNumberOfRoutes(routeTable *ec2.RouteTable, n int) resource.TestCheckFunc {
Copy link
Contributor

Choose a reason for hiding this comment

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

We should try to move away from API object TestCheckFunc like these in preference of state value and ImportStateVerify checks -- please see: #16435

@bflad bflad added the technical-debt Addresses areas of the codebase that need refactoring or redesign. label Dec 3, 2020
@bflad bflad self-assigned this Dec 3, 2020
Co-authored-by: Brian Flad <bflad417@gmail.com>
@ewbankkit
Copy link
Contributor Author

Validated renamed-after-review acceptance test:

$ make testacc TEST=./aws/ TESTARGS='-run=TestAccAWSDefaultRouteTable_disappears_Vpc'
==> Checking that code complies with gofmt requirements...
TF_ACC=1 go test ./aws -v -count 1 -parallel 20 -run=TestAccAWSDefaultRouteTable_disappears_Vpc -timeout 120m
=== RUN   TestAccAWSDefaultRouteTable_disappears_Vpc
=== PAUSE TestAccAWSDefaultRouteTable_disappears_Vpc
=== CONT  TestAccAWSDefaultRouteTable_disappears_Vpc
--- PASS: TestAccAWSDefaultRouteTable_disappears_Vpc (15.59s)
PASS
ok  	github.com/terraform-providers/terraform-provider-aws/aws	15.632s

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.

Let's get this in 🚀

Output from acceptance testing:

--- PASS: TestAccAWSDefaultRouteTable_basic (79.29s)
--- PASS: TestAccAWSDefaultRouteTable_ConditionalCidrBlock (108.38s)
--- PASS: TestAccAWSDefaultRouteTable_disappears_Vpc (33.90s)
--- PASS: TestAccAWSDefaultRouteTable_IPv4_To_TransitGateway (375.62s)
--- PASS: TestAccAWSDefaultRouteTable_IPv4_To_VpcEndpoint (314.21s)
--- PASS: TestAccAWSDefaultRouteTable_Route_ConfigMode (142.00s)
--- PASS: TestAccAWSDefaultRouteTable_swap (140.28s)
--- PASS: TestAccAWSDefaultRouteTable_tags (116.89s)
--- PASS: TestAccAWSDefaultRouteTable_VpcEndpointAssociation (83.20s)

@bflad bflad added this to the v3.21.0 milestone Dec 7, 2020
@bflad bflad merged commit 1e3b1da into hashicorp:master Dec 7, 2020
@ewbankkit ewbankkit deleted the t-additional-aws_default_route_table-tests branch December 7, 2020 17:08
@ghost
Copy link

ghost commented Dec 11, 2020

This has been released in version 3.21.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 Jan 6, 2021

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 as resolved and limited conversation to collaborators Jan 6, 2021
Sign up for free to subscribe to this conversation on GitHub. Already have an account? Sign in.
Labels
service/ec2 Issues and PRs that pertain to the ec2 service. size/XL 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.

3 participants