-
Notifications
You must be signed in to change notification settings - Fork 42
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
Fix setting env name with a property #568
Fix setting env name with a property #568
Conversation
s.NoError(os.Setenv("TEMPORAL_ENV", "myenv")) | ||
defer os.Unsetenv("TEMPORAL_ENV") |
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.
You should be able to replace LookupEnv
in the CLI options instead of using actual environment variables that affect everything globally. See TestWorkflow_Execute_EnvVars
in commands.workflow_exec_test.go
for an example (I saw we unfortunately have others not doing this in tests that should).
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 saw that but I though using a system property "for real" may be a better test than faking it... Are there any side-effects of using a real system property in the test?
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 can damage our ability to do parallel tests in the future. Tests need to be as self-contained as possible. It's mocked out at the highest level, so you're not getting much more using the real env var I don't think.
@@ -89,6 +89,8 @@ func NewCommandContext(ctx context.Context, options CommandOptions) (*CommandCon | |||
return cctx, stop, nil | |||
} | |||
|
|||
const temporalEnv = "TEMPORAL_ENV" |
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 don't think there's much value in making this a constant that is used in one place, but meh
What was changed
Ensure that we read the property
TEMPORAL_ENV
, which sets then env name,early on, i.e., in
preprocessOptions
.Why?
Otherwise it is too late to have an effect...
Checklist
[Bug] TEMPORAL_ENV may not be working #541
Added a system test
3. Any docs updates needed?
No