Support env_inherit on service_test#76
Conversation
This is useful when a test requires something like credentials which shouldn't invalidate the entire graph.
There was a problem hiding this comment.
💡 Codex Review
Here are some automated review suggestions for this pull request.
Reviewed commit: 9b2bbd6cb6
ℹ️ About Codex in GitHub
Codex has been enabled to automatically review pull requests in this repo. Reviews are triggered when you
- Open a pull request for review
- Mark a draft as ready
- Comment "@codex review".
If Codex has suggestions, it will comment; otherwise it will react with 👍.
When you sign up for Codex through ChatGPT, Codex can also answer questions or update the PR, like "@codex address that feedback".
|
|
||
| return [ | ||
| RunEnvironmentInfo(environment = fixed_env), | ||
| RunEnvironmentInfo(environment = fixed_env, inherited_environment = ctx.attr.env_inherit), |
There was a problem hiding this comment.
Merge inherited env from wrapped tests
When service_test wraps a test rule that already declares inherited environment through RunEnvironmentInfo (for example a go_test(env_inherit = ["FOO"])), this line drops that provider field and only forwards variables repeated on the wrapper. Under bazel test, Bazel only places inherited variables in the outer svcinit environment when this returned provider requests them, and buildTestEnv then builds the real test process environment from svcinit's os.Environ(), so the wrapped test silently loses FOO unless users duplicate the setting on every service_test. Please include ctx.attr.test[RunEnvironmentInfo].inherited_environment when constructing the wrapper's inherited environment.
Useful? React with 👍 / 👎.
Allows populating the inherited_environment.