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

aws/provider: update to using typelist + add empty condition acctest #13334

Merged
merged 3 commits into from
May 19, 2020

Conversation

anGie44
Copy link
Contributor

@anGie44 anGie44 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 #9956

Release note for CHANGELOG:

aws/provider: correct typeset usage with typelist in cases where max_items is 1

Output from acceptance testing:

--- PASS: TestAccAWSProvider_Region_AwsChina (3.55s)
--- PASS: TestAccAWSProvider_Region_AwsCommercial (3.55s)
--- PASS: TestAccAWSProvider_Region_AwsGovCloudUs (3.56s)
--- PASS: TestAccAWSProvider_IgnoreTags_Keys_One (3.74s)
--- PASS: TestAccAWSProvider_IgnoreTags_EmptyConfigurationBlock (3.74s)
--- PASS: TestAccAWSProvider_IgnoreTags_KeyPrefixes_None (3.74s)
--- PASS: TestAccAWSProvider_IgnoreTags_KeyPrefixes_One (3.74s)
--- PASS: TestAccAWSProvider_IgnoreTags_Keys_Multiple (3.74s)
--- PASS: TestAccAWSProvider_IgnoreTags_Keys_None (3.75s)
--- PASS: TestAccAWSProvider_IgnoreTags_KeyPrefixes_Multiple (3.76s)
--- PASS: TestAccAWSProvider_Endpoints_Deprecated (3.78s)
--- PASS: TestAccAWSProvider_Endpoints (3.83s)
--- PASS: TestAccAWSProvider_AssumeRole_Empty (19.18s)

@ghost ghost added size/XS Managed by automation to categorize the size of a PR. provider Pertains to the provider itself, rather than any interaction with AWS. labels May 15, 2020
@anGie44 anGie44 added the technical-debt Addresses areas of the codebase that need refactoring or redesign. label May 15, 2020
@anGie44 anGie44 marked this pull request as ready for review May 15, 2020 16:00
@anGie44 anGie44 requested a review from a team May 15, 2020 16:00
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.

Haha okay hear me out... what if I told you there is this mysterious other acceptance test for provider functionality that probably no one remembers that actually catches a panic bug?

=== CONT  TestAccAWSCallerIdentity_basic_panic
------- Stderr: -------
panic: interface conversion: interface {} is nil, not map[string]interface {}
goroutine 137 [running]:
github.com/terraform-providers/terraform-provider-aws/aws.providerConfigure(0xc0012a52d0, 0xc000a26590, 0xa, 0xc0012a52d0, 0xc0000581a0, 0x0, 0x0)
  /opt/teamcity-agent/work/2e10e023da0c7520/src/github.com/terraform-providers/terraform-provider-aws/aws/provider.go:1174 +0x1069
github.com/terraform-providers/terraform-provider-aws/aws.Provider.func1(0xc0012a52d0, 0x0, 0xc000a56660, 0xc0012a52d0, 0x0)
  /opt/teamcity-agent/work/2e10e023da0c7520/src/github.com/terraform-providers/terraform-provider-aws/aws/provider.go:932 +0x58
github.com/hashicorp/terraform-plugin-sdk/helper/schema.(*Provider).Configure(0xc0004cc880, 0xc00163d080, 0x5a4f3c0, 0xc00163cf30)
  /opt/teamcity-agent/work/2e10e023da0c7520/src/github.com/terraform-providers/terraform-provider-aws/vendor/github.com/hashicorp/terraform-plugin-sdk/helper/schema/provider.go:275 +0xf6

So! Rather than this weird (I don't even remember how I remembered it) test floating off in some other testing namespace, it would be great to:

  1. Move that test into aws/provider_test.go
  2. Rename it something like TestAccAWSProvider_AssumeRole_Empty
  3. Try removing the aws_caller_identity bits and ensure it still fails!
  4. Try fixing it and bask in the glory of making all the things better! 🎉

Please let me know if you run into any trouble and thank you for working on this!

@bflad bflad self-assigned this May 15, 2020
@bflad
Copy link
Contributor

bflad commented May 15, 2020

(You may also want to update the PR description to not use the Closes keyword, since there's other things that need to get merged first 😄 )

@anGie44 anGie44 linked an issue May 15, 2020 that may be closed by this pull request
28 tasks
@ghost ghost added service/sts Issues and PRs that pertain to the sts service. tests PRs: expanded test coverage. Issues: expanded coverage, enhancements to test infrastructure. size/M Managed by automation to categorize the size of a PR. and removed size/XS Managed by automation to categorize the size of a PR. labels May 15, 2020
@anGie44
Copy link
Contributor Author

anGie44 commented May 15, 2020

updated (i think) as suggested @bflad! I'm really not a fan of these [nil] 😆

@anGie44 anGie44 changed the title aws/provider: update to using typelist aws/provider: update to using typelist + add empty condition acctest May 15, 2020
@anGie44 anGie44 requested a review from bflad May 15, 2020 18:08
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.

LGTM 🚀

Output from acceptance testing:

--- PASS: TestAccAWSProvider_Region_AwsCommercial (7.41s)
--- PASS: TestAccAWSProvider_IgnoreTags_KeyPrefixes_Multiple (8.34s)
--- PASS: TestAccAWSProvider_Region_AwsChina (8.78s)
--- PASS: TestAccAWSProvider_Region_AwsGovCloudUs (8.91s)
--- PASS: TestAccAWSProvider_IgnoreTags_KeyPrefixes_One (9.16s)
--- PASS: TestAccAWSProvider_IgnoreTags_KeyPrefixes_None (9.18s)
--- PASS: TestAccAWSProvider_IgnoreTags_Keys_None (9.30s)
--- PASS: TestAccAWSProvider_IgnoreTags_Keys_One (9.39s)
--- PASS: TestAccAWSProvider_IgnoreTags_Keys_Multiple (9.60s)
--- PASS: TestAccAWSProvider_Endpoints_Deprecated (9.46s)
--- PASS: TestAccAWSProvider_IgnoreTags_EmptyConfigurationBlock (9.40s)
--- PASS: TestAccAWSProvider_Endpoints (9.51s)
--- PASS: TestAccAWSProvider_AssumeRole_Empty (13.91s)

@anGie44 anGie44 merged commit 63a186e into master May 19, 2020
@anGie44 anGie44 deleted the ap_typelist_provider branch May 19, 2020 21:36
@ghost
Copy link

ghost commented Jun 19, 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 Jun 19, 2020
Sign up for free to subscribe to this conversation on GitHub. Already have an account? Sign in.
Labels
provider Pertains to the provider itself, rather than any interaction with AWS. service/sts Issues and PRs that pertain to the sts service. size/M 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.

Fix and enable tfproviderlint S018 check: Use TypeList and MaxItems: 1
2 participants