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

Acceptance tests: Check for default subnets when no subnet_id specified #13361

Closed

Conversation

ewbankkit
Copy link
Contributor

@ewbankkit ewbankkit commented May 15, 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

Relates #13260.
Relates #11126.

Add a "PreCheck" for default subnets in a default VPC for test cases where an instance is launched without specifying a subnet_id.

Release note for CHANGELOG:

NONE

Output from acceptance testing:

# Ensure no regression when metadata options tests are run with a standalone VPC:
$ make testacc TEST=./aws/ TESTARGS='-run=TestAccAWSInstanceDataSource_metadataOptions'
==> Checking that code complies with gofmt requirements...
TF_ACC=1 go test ./aws/ -v -count 1 -parallel 20 -run=TestAccAWSInstanceDataSource_metadataOptions -timeout 120m
=== RUN   TestAccAWSInstanceDataSource_metadataOptions
=== PAUSE TestAccAWSInstanceDataSource_metadataOptions
=== CONT  TestAccAWSInstanceDataSource_metadataOptions
--- PASS: TestAccAWSInstanceDataSource_metadataOptions (134.28s)
PASS
ok  	github.com/terraform-providers/terraform-provider-aws/aws	134.316s
$ make testacc TEST=./aws/ TESTARGS='-run=TestAccAWSInstance_metadataOptions'
==> Checking that code complies with gofmt requirements...
TF_ACC=1 go test ./aws/ -v -count 1 -parallel 20 -run=TestAccAWSInstance_metadataOptions -timeout 120m
=== RUN   TestAccAWSInstance_metadataOptions
=== PAUSE TestAccAWSInstance_metadataOptions
=== CONT  TestAccAWSInstance_metadataOptions
--- PASS: TestAccAWSInstance_metadataOptions (166.16s)
PASS
ok  	github.com/terraform-providers/terraform-provider-aws/aws	166.193s
# EC2-Classic
$ AWS_DEFAULT_REGION=us-east-1 make testacc TEST=./aws/ TESTARGS='-run=TestAccAWSInstance_basic'
==> Checking that code complies with gofmt requirements...
TF_ACC=1 go test ./aws/ -v -count 1 -parallel 20 -run=TestAccAWSInstance_basic -timeout 120m
=== RUN   TestAccAWSInstance_basic
=== PAUSE TestAccAWSInstance_basic
=== CONT  TestAccAWSInstance_basic
--- PASS: TestAccAWSInstance_basic (85.47s)
PASS
ok  	github.com/terraform-providers/terraform-provider-aws/aws	85.533s
# Default VPC with default subnets
$ AWS_DEFAULT_REGION=eu-central-1 make testacc TEST=./aws/ TESTARGS='-run=TestAccAWSInstance_basic'
==> Checking that code complies with gofmt requirements...
TF_ACC=1 go test ./aws/ -v -count 1 -parallel 20 -run=TestAccAWSInstance_basic -timeout 120m
=== RUN   TestAccAWSInstance_basic
=== PAUSE TestAccAWSInstance_basic
=== CONT  TestAccAWSInstance_basic
--- PASS: TestAccAWSInstance_basic (118.50s)
PASS
ok  	github.com/terraform-providers/terraform-provider-aws/aws	118.551s
$ AWS_DEFAULT_REGION=eu-west-1 make testacc TEST=./aws/ TESTARGS='-run=TestAccAWSInstance_basic'
# No default VPC
==> Checking that code complies with gofmt requirements...
TF_ACC=1 go test ./aws/ -v -count 1 -parallel 20 -run=TestAccAWSInstance_basic -timeout 120m
=== RUN   TestAccAWSInstance_basic
=== PAUSE TestAccAWSInstance_basic
=== CONT  TestAccAWSInstance_basic
--- SKIP: TestAccAWSInstance_basic (2.87s)
    provider_test.go:1305: skipping tests; eu-west-1 does not have EC2-Classic or a default VPC with default subnets
PASS
ok  	github.com/terraform-providers/terraform-provider-aws/aws	2.908s
# Default VPC but no default subnets
$ AWS_DEFAULT_REGION=eu-west-2 make testacc TEST=./aws/ TESTARGS='-run=TestAccAWSInstance_basic'
==> Checking that code complies with gofmt requirements...
TF_ACC=1 go test ./aws/ -v -count 1 -parallel 20 -run=TestAccAWSInstance_basic -timeout 120m
=== RUN   TestAccAWSInstance_basic
=== PAUSE TestAccAWSInstance_basic
=== CONT  TestAccAWSInstance_basic
--- SKIP: TestAccAWSInstance_basic (3.10s)
    provider_test.go:1305: skipping tests; eu-west-2 does not have EC2-Classic or a default VPC with default subnets
PASS
ok  	github.com/terraform-providers/terraform-provider-aws/aws	3.164s

Without the additional PreCheck the Default VPC but no default subnets case errors out:

$ AWS_DEFAULT_REGION=eu-west-2 make testacc TEST=./aws/ TESTARGS='-run=TestAccAWSInstance_basic'
==> Checking that code complies with gofmt requirements...
TF_ACC=1 go test ./aws/ -v -count 1 -parallel 20 -run=TestAccAWSInstance_basic -timeout 120m
=== RUN   TestAccAWSInstance_basic
=== PAUSE TestAccAWSInstance_basic
=== CONT  TestAccAWSInstance_basic
--- FAIL: TestAccAWSInstance_basic (12.65s)
    testing.go:684: Step 0 error: errors during apply:
        
        Error: Error launching source instance: MissingInput: No subnets found for the default VPC 'vpc-06beb66f'. Please specify a subnet.
        	status code: 400, request id: a04a29ad-831c-4b59-8ccb-881471fed238
        
          on /tmp/tf-test353589136/main.tf line 26:
          (source code not available)
        
        
FAIL
FAIL	github.com/terraform-providers/terraform-provider-aws/aws	12.679s
FAIL
GNUmakefile:26: recipe for target 'testacc' failed
make: *** [testacc] Error 1

@ewbankkit ewbankkit requested a review from a team May 15, 2020 21:36
@ghost ghost added size/M Managed by automation to categorize the size of a PR. needs-triage Waiting for first response or review from a maintainer. service/ec2 Issues and PRs that pertain to the ec2 service. tests PRs: expanded test coverage. Issues: expanded coverage, enhancements to test infrastructure. labels May 15, 2020
@ewbankkit

This comment has been minimized.

@ghost ghost added size/L Managed by automation to categorize the size of a PR. and removed size/M Managed by automation to categorize the size of a PR. labels May 17, 2020
@ewbankkit ewbankkit changed the title Acceptance tests: Check for default subnets when no subnet_id specified [WIP] Acceptance tests: Check for default subnets when no subnet_id specified Jun 2, 2020
@ewbankkit ewbankkit force-pushed the td-check-for-default-subnets branch from 22816ab to 72bcbce Compare June 2, 2020 13:36
@ghost ghost added size/S Managed by automation to categorize the size of a PR. and removed size/L Managed by automation to categorize the size of a PR. labels Jun 2, 2020
@ewbankkit ewbankkit force-pushed the td-check-for-default-subnets branch from 72bcbce to 63710a6 Compare June 2, 2020 13:46
@ewbankkit

This comment has been minimized.

@ewbankkit ewbankkit force-pushed the td-check-for-default-subnets branch from f7553b4 to c9694fa Compare June 2, 2020 15:45
@ghost ghost added size/M Managed by automation to categorize the size of a PR. and removed size/S Managed by automation to categorize the size of a PR. labels Jun 2, 2020
@ewbankkit ewbankkit changed the title [WIP] Acceptance tests: Check for default subnets when no subnet_id specified Acceptance tests: Check for default subnets when no subnet_id specified Jun 22, 2020
@ewbankkit
Copy link
Contributor Author

Removed WIP. Ready for review.

@ewbankkit ewbankkit force-pushed the td-check-for-default-subnets branch from cf6408c to 6e754f3 Compare July 28, 2020 13:32
@ewbankkit
Copy link
Contributor Author

Changes have been incorporated into #14159.

@ewbankkit ewbankkit closed this Jul 28, 2020
@ewbankkit ewbankkit deleted the td-check-for-default-subnets branch July 28, 2020 20:59
ewbankkit added a commit to ewbankkit/terraform-provider-aws that referenced this pull request Aug 6, 2020
Acceptance test output:

$ make testacc TEST=./aws/ TESTARGS='-run=TestAccAWSInstanceDataSource_metadataOptions'
==> Checking that code complies with gofmt requirements...
TF_ACC=1 go test ./aws -v -count 1 -parallel 20 -run=TestAccAWSInstanceDataSource_metadataOptions -timeout 120m
=== RUN   TestAccAWSInstanceDataSource_metadataOptions
=== PAUSE TestAccAWSInstanceDataSource_metadataOptions
=== CONT  TestAccAWSInstanceDataSource_metadataOptions
--- PASS: TestAccAWSInstanceDataSource_metadataOptions (108.64s)
PASS
ok  	github.com/terraform-providers/terraform-provider-aws/aws	108.691s
$ make testacc TEST=./aws/ TESTARGS='-run=TestAccAWSInstance_metadataOptions'
==> Checking that code complies with gofmt requirements...
TF_ACC=1 go test ./aws -v -count 1 -parallel 20 -run=TestAccAWSInstance_metadataOptions -timeout 120m
=== RUN   TestAccAWSInstance_metadataOptions
=== PAUSE TestAccAWSInstance_metadataOptions
=== CONT  TestAccAWSInstance_metadataOptions
--- PASS: TestAccAWSInstance_metadataOptions (111.01s)
PASS
ok  	github.com/terraform-providers/terraform-provider-aws/aws	111.055s
$ make testacc TEST=./aws/ TESTARGS='-run=TestAccAWSInstance_basic'
==> Checking that code complies with gofmt requirements...
TF_ACC=1 go test ./aws -v -count 1 -parallel 20 -run=TestAccAWSInstance_basic -timeout 120m
=== RUN   TestAccAWSInstance_basic
=== PAUSE TestAccAWSInstance_basic
=== CONT  TestAccAWSInstance_basic
--- PASS: TestAccAWSInstance_basic (75.67s)
PASS
ok  	github.com/terraform-providers/terraform-provider-aws/aws	75.781s
@ghost
Copy link

ghost commented Aug 28, 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 Aug 28, 2020
@breathingdust breathingdust removed the needs-triage Waiting for first response or review from a maintainer. label Sep 17, 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/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