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

test: use T.Setenv to set env vars in tests #1985

Merged
merged 1 commit into from Oct 21, 2022
Merged

test: use T.Setenv to set env vars in tests #1985

merged 1 commit into from Oct 21, 2022

Conversation

Juneezee
Copy link
Contributor

@Juneezee Juneezee commented Oct 20, 2022

A testing cleanup.

This PR replaces os.Setenv with t.Setenv. Starting from Go 1.17, we can use t.Setenv to set environment variable in test. The environment variable is automatically restored to its original value when the test and all its subtests complete. This ensures that each test does not start with leftover environment variables from previous completed tests.

@github-actions
Copy link
Contributor

github-actions bot commented Oct 20, 2022

changelog detected ✅

This commit replaces `os.Setenv` with `t.Setenv` in tests. The
environment variable is automatically restored to its original value
when the test and all its subtests complete.

Reference: https://pkg.go.dev/testing#T.Setenv
Signed-off-by: Eng Zer Jun <engzerjun@gmail.com>
@jacobbednarz jacobbednarz merged commit a6e0cb8 into cloudflare:master Oct 21, 2022
@jacobbednarz
Copy link
Member

thanks @Juneezee, appreciate it.

@github-actions github-actions bot added this to the v3.27.0 milestone Oct 21, 2022
github-actions bot pushed a commit that referenced this pull request Oct 21, 2022
@github-actions
Copy link
Contributor

github-actions bot commented Nov 2, 2022

This functionality has been released in v3.27.0 of the Terraform Cloudflare 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. Thank you!

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

Successfully merging this pull request may close these issues.

None yet

2 participants