-
Notifications
You must be signed in to change notification settings - Fork 125
Remove calls to t.Setenv from integration tests
#2018
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
Conversation
|
It would be nicer to have a linter to prevent |
|
If integration tests don't run automatically, an authorized user can run them manually by following the instructions below: Trigger: Inputs:
Checks will be approved automatically on success. |
|
The integration test The context already had a call to Use the fixture helpers instead of calling commands to fix this. |
denik
left a comment
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.
Regarding "panic: dbr.DetectRuntime called twice on the same context" and changes in git_fetch_test.go.
While it does look cleaner to use helpers, it's weird that you can longer call "workspace mkdirs" followed by "workspace delete" - this suggests that something else is broken.
Another thing that is not clear is why does DetectRuntime fails when called second time instead of being idempotent?
| } | ||
|
|
||
| func ensureWorkspacePrefix(root string) string { | ||
| // The fixture helper doesn't include /Workspace, so include it here. |
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.
Why not fix the fixture helper instead to generate right path?
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.
I tried this but there are assumptions elsewhere on the prefix not being included.
I'd like to address this in a separate PR and normalize on having the /Workspace prefix everywhere.
This was prevented by the It panics on the second call as a sanity check that we're not mocking/detecting multiple times. |
|
The integration tests passed. Only the hooks to make a comment and mark the check as successful failed. |
Changes
The
Setenvhelper function configures an environment variable and resets it to its original value when exiting the test scope. It is incompatible with running tests in parallel because it modifies process-wide state. Thelibs/envpackage defines functions to interact with the environment but recordsSetenvcalls on acontext.Context. This enables us to override/specialize the environment scoped to a context.Pre-requisites for removing the
t.Setenvcalls:cmdio.NewIOaccept a context and use it withlibs/envinternal/testclifunctions use a contextThe rest of this change:
t.Setenvcalls to useenv.SetTests
n/a