-
Notifications
You must be signed in to change notification settings - Fork 9.3k
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: Migrate environment variable functionality into shared package with constants and testing #17197
Conversation
…d package with constants and testing Reference: #17083 Other environment variable handling in the code and testing can be migrated in the future for consistency. Please note that if attempting to use the returned value in a test configuration function, it must be done outside the test PreCheck function due to execution during compilation versus run. Without GITHUB_TOKEN set: ``` === RUN TestAccAWSCodePipeline_WithGitHubv1SourceAction resource_aws_codepipeline_test.go:470: skipping test; environment variable GITHUB_TOKEN must be set. Usage: token with GitHub permissions to repository for CodePipeline source configuration --- SKIP: TestAccAWSCodePipeline_WithGitHubv1SourceAction (0.00s) === RUN TestAccAWSCodePipelineWebhook_basic resource_aws_codepipeline_webhook_test.go:18: skipping test; environment variable GITHUB_TOKEN must be set. Usage: token with GitHub permissions to repository for CodePipeline webhook creation --- SKIP: TestAccAWSCodePipelineWebhook_basic (0.00s) === RUN TestAccAWSCodePipelineWebhook_ipAuth resource_aws_codepipeline_webhook_test.go:52: skipping test; environment variable GITHUB_TOKEN must be set. Usage: token with GitHub permissions to repository for CodePipeline webhook creation --- SKIP: TestAccAWSCodePipelineWebhook_ipAuth (0.00s) === RUN TestAccAWSCodePipelineWebhook_unauthenticated resource_aws_codepipeline_webhook_test.go:86: skipping test; environment variable GITHUB_TOKEN must be set. Usage: token with GitHub permissions to repository for CodePipeline webhook creation --- SKIP: TestAccAWSCodePipelineWebhook_unauthenticated (0.00s) === RUN TestAccAWSCodePipelineWebhook_tags resource_aws_codepipeline_webhook_test.go:118: skipping test; environment variable GITHUB_TOKEN must be set. Usage: token with GitHub permissions to repository for CodePipeline webhook creation --- SKIP: TestAccAWSCodePipelineWebhook_tags (0.00s) === RUN TestAccAWSCodePipelineWebhook_UpdateAuthenticationConfiguration_SecretToken resource_aws_codepipeline_webhook_test.go:181: skipping test; environment variable GITHUB_TOKEN must be set. Usage: token with GitHub permissions to repository for CodePipeline webhook creation --- SKIP: TestAccAWSCodePipelineWebhook_UpdateAuthenticationConfiguration_SecretToken (0.00s) ``` Output from acceptance testing: ``` # Verify GITHUB_TOKEN working --- PASS: TestAccAWSCodePipeline_WithGitHubv1SourceAction (55.64s) --- PASS: TestAccAWSCodePipelineWebhook_basic (32.74s) --- PASS: TestAccAWSCodePipelineWebhook_ipAuth (33.24s) --- PASS: TestAccAWSCodePipelineWebhook_tags (71.80s) --- PASS: TestAccAWSCodePipelineWebhook_unauthenticated (32.65s) --- PASS: TestAccAWSCodePipelineWebhook_UpdateAuthenticationConfiguration_SecretToken (54.08s) # Verify cross-region and cross-account --- PASS: TestAccAWSDynamoDbTable_Replica_Multiple (1646.42s) --- PASS: TestAccAWSRoute53ZoneAssociation_CrossAccount (160.38s) --- PASS: TestAccAWSProvider_AssumeRole_Empty (15.68s) --- PASS: TestAccAWSProvider_Endpoints (13.10s) --- PASS: TestAccAWSProvider_IgnoreTags_EmptyConfigurationBlock (12.44s) --- PASS: TestAccAWSProvider_IgnoreTags_KeyPrefixes_Multiple (12.87s) --- PASS: TestAccAWSProvider_IgnoreTags_KeyPrefixes_None (12.49s) --- PASS: TestAccAWSProvider_IgnoreTags_KeyPrefixes_One (12.71s) --- PASS: TestAccAWSProvider_IgnoreTags_Keys_Multiple (12.57s) --- PASS: TestAccAWSProvider_IgnoreTags_Keys_None (12.23s) --- PASS: TestAccAWSProvider_IgnoreTags_Keys_One (12.71s) --- PASS: TestAccAWSProvider_Region_AwsChina (9.82s) --- PASS: TestAccAWSProvider_Region_AwsCommercial (10.42s) --- PASS: TestAccAWSProvider_Region_AwsGovCloudUs (11.37s) ```
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
This is so clean, it could be a new line of detergent! 🧼
--- PASS: TestGetWithDefault (0.00s)
--- PASS: TestGetWithDefault/missing (0.00s)
--- PASS: TestGetWithDefault/empty (0.00s)
--- PASS: TestGetWithDefault/not_empty (0.00s)
--- PASS: TestTestFailIfAllEmpty (0.00s)
--- PASS: TestTestFailIfAllEmpty/missing (0.00s)
--- PASS: TestTestFailIfAllEmpty/all_empty (0.00s)
--- PASS: TestTestFailIfAllEmpty/some_empty (0.00s)
--- PASS: TestTestFailIfAllEmpty/all_not_empty (0.00s)
--- PASS: TestTestFailIfEmpty (0.00s)
--- PASS: TestTestFailIfEmpty/missing (0.00s)
--- PASS: TestTestFailIfEmpty/empty (0.00s)
--- PASS: TestTestFailIfEmpty/not_empty (0.00s)
--- PASS: TestTestSkipIfEmpty (0.00s)
--- PASS: TestTestSkipIfEmpty/missing (0.00s)
--- PASS: TestTestSkipIfEmpty/empty (0.00s)
--- PASS: TestTestSkipIfEmpty/not_empty (0.00s)
GovCloud (without GitHub token):
--- PASS: TestAccAWSProvider_AssumeRole_Empty (13.34s)
--- PASS: TestAccAWSProvider_Endpoints (5.34s)
--- PASS: TestAccAWSProvider_IgnoreTags_Keys_Multiple (4.93s)
--- PASS: TestAccAWSProvider_Region_AwsGovCloudUs (3.90s)
--- PASS: TestAccAWSRoute53ZoneAssociation_CrossAccount (95.18s)
--- SKIP: TestAccAWSCodePipelineWebhook_basic (0.00s)
us-west-2
(with and without GitHub token):
--- PASS: TestAccAWSCodePipelineWebhook_basic (36.18s)
--- PASS: TestAccAWSProvider_AssumeRole_Empty (8.55s)
--- PASS: TestAccAWSProvider_Endpoints (4.46s)
--- PASS: TestAccAWSProvider_IgnoreTags_Keys_Multiple (4.32s)
--- PASS: TestAccAWSProvider_Region_AwsGovCloudUs (3.43s)
--- PASS: TestAccAWSRoute53ZoneAssociation_CrossAccount (159.83s)
--- SKIP: TestAccAWSCodePipelineWebhook_basic (0.00s)
This has been released in version 3.27.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! |
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! |
Community Note
Closes #17083
Release note for CHANGELOG:
Other environment variable handling in the code and testing can be migrated in the future for consistency. Please note that if attempting to use the returned value in a test configuration function, it must be done outside the test PreCheck function due to execution during compilation versus run.
Without GITHUB_TOKEN set:
Output from acceptance testing: