-
Notifications
You must be signed in to change notification settings - Fork 9.2k
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
Extend testAccEnvironmentVariableSetPreCheck() with optional custom message and return value #17083
Comments
…constants, enhance environment variable PreCheck function Reference: #17083
…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) ```
…d package with constants and testing (#17197) 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) ```
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! |
The function
testAccEnvironmentVariableSetPreCheck()
, introduced in #16959, skips an acceptance test if a specified environment variable is not set.By adding a custom message, we could replace custom handling in other acceptance tests.
The function should also return the value of the environment variable.
The text was updated successfully, but these errors were encountered: