Skip to content

Support env_inherit on service_test#76

Open
blampe wants to merge 1 commit into
hermeticbuild:masterfrom
blampe:blampe/env_inherit
Open

Support env_inherit on service_test#76
blampe wants to merge 1 commit into
hermeticbuild:masterfrom
blampe:blampe/env_inherit

Conversation

@blampe

@blampe blampe commented Jul 22, 2026

Copy link
Copy Markdown

Allows populating the inherited_environment.

This is useful when a test requires something like credentials which
shouldn't invalidate the entire graph.

@chatgpt-codex-connector chatgpt-codex-connector Bot left a comment

Copy link
Copy Markdown

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

💡 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".

Comment thread private/itest.bzl

return [
RunEnvironmentInfo(environment = fixed_env),
RunEnvironmentInfo(environment = fixed_env, inherited_environment = ctx.attr.env_inherit),

Copy link
Copy Markdown

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

P2 Badge 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 👍 / 👎.

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.

1 participant