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

Fail if using SKIP_ env vars while running multiple parallel tests #1280

Open
Octogonapus opened this issue May 2, 2023 · 0 comments
Open
Labels
enhancement New feature or request p:needs triage Needs to be processed by maintainer and issue type / priority added

Comments

@Octogonapus
Copy link

I recognize this is user error, but I ran into a problem where I accidentally ran multiple parallel tests locally using a SKIP_ environment variable, so all these tests ran against the same Terraform directory and broke each other. You get very weird and concerning error messages like:

TestFoo 2023-05-02T11:08:37-04:00 logger.go:66: │ Error: Failed to download module
TestFoo 2023-05-02T11:08:37-04:00 logger.go:66: │ 
TestFoo 2023-05-02T11:08:37-04:00 logger.go:66: │ Could not download module "redacted" (redacted.tf:1) source code from
TestFoo 2023-05-02T11:08:37-04:00 logger.go:66: │ "git::https://github.com/redacted/redacted.git?ref=v6.2.1":
TestFoo 2023-05-02T11:08:37-04:00 logger.go:66: │ error downloading
TestFoo 2023-05-02T11:08:37-04:00 logger.go:66: │ 'https://github.com/redacted/redacted.git?ref=v6.2.1':
TestFoo 2023-05-02T11:08:37-04:00 logger.go:66: │ /usr/bin/git exited with -1: Cloning into '.terraform/modules/redacted'...
TestFoo 2023-05-02T11:08:37-04:00 logger.go:66: │ BUG: refs/files-backend.c:3040: initial ref transaction called with
TestFoo 2023-05-02T11:08:37-04:00 logger.go:66: │ existing refs

This was an easy mistake for me to make because I have tests like TestFoo and TestFooBadDeployment, etc. I wanted to run only TestFoo, so I ran SKIP_teardown=1 go test -v -timeout 60m -run TestFoo, but of course this ran (effectively) TestFoo*.

Perhaps a lock file could be written inside the .test-data directory? Then other parallel tests could try to make the same lock file and fail.

@denis256 denis256 added enhancement New feature or request p:needs triage Needs to be processed by maintainer and issue type / priority added labels May 2, 2023
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
enhancement New feature or request p:needs triage Needs to be processed by maintainer and issue type / priority added
Projects
None yet
Development

No branches or pull requests

2 participants