feat: Add per-child environment for test spawning #79
All Vouch review confidence checks passed
Residual risk 0.18 = Change Risk (0.46) × (1 − Review Confidence (0.60)).
Review depth and reviewer attention state are adequate.
Model 1 · Change Risk (XGBoost)
Score: 0.46 · 458 lines diff across 5 files
Model 2 · Review Depth (DistilBERT)
Depth Score: 0.17 · 1 substantive comment(s)
Model 3 · Review Timing & Attention
Session adequacy: 100% · Reviewer familiarity: 35%
Bedrock Claude 3 · Risk Narration
(disconnected)
Groq Risk Narration
AWS Bedrock is currently disconnected. Generate high-confidence PR triage narration on-demand using Groq.
Model 1 · Change Risk Attribution
SHAP Weights
Diff Size
diff_size
0.367
Shallow Review Depth
shallow_review_depth
0.289
Real PR Conversation Timeline
1 comments
"Review active on #79"
general
weight: 0.35
mgahagan73
Summary
Env map[string]stringtoExtensionTestSpecfor per-test child-process environment variables.AddBeforeSpawn, which runs immediately beforeRunParalleland can populateEnvor adjustTimeout.SpawnProcessToRunTestWithEnvand wire Ginkgo-generated runners to passspec.Envto the child process.EnvbeforeBeforeEachso callback mutations cannot change the environment passed to the child.BeforeSpawnfor in-processRunexecution, including single-specrun-testchildren, while retaining the spawned-child marker as an additional guard.Motivation
OTE normally runs parallel tests in separate OS processes. Previously there was no supported way for the parent scheduler to pass per-test runtime data to a child. Consumers such as ARO-HCP therefore needed filesystem-based coordination to bind a scheduled test to a concrete shared resource.
BeforeSpawnlets the parent allocate that resource after scheduler dispatch and place the assignment inspec.Env. The environment-aware runner then passes the assignment directly to the child process.Behavior and compatibility
SpawnProcessToRunTestkeeps its existing signature and delegates to the environment-aware implementation.BeforeSpawnruns only for specs that will useRunParallel; it does not run for the in-processRunpath.RunParallelfunctions automatically mergespec.Envinto the child environment. Custom runners must consumespec.Envthemselves.Envand adjustTimeout, but must not mutate scheduler-owned resource fields after dispatch.Envis valid. Hooks that assign individual keys must initialize the map first.=or NUL; values cannot contain NUL.OTE_SPAWNED_CHILDmarker cannot be overridden.NewSchedulerrejects nil specs and duplicate spec pointers because one pointer cannot safely identify multiple concurrent executions.Test plan
BeforeSpawnordering, composition, in-process skip, and built-in/custom child-process lifecycle tests.BeforeEachenvironment-isolation and JSON-omission tests.go build ./...go test -race ./...<!-- This is an auto-generated comment: release notes by coderabbit.ai -->
Summary by CodeRabbit
- Added configurable pre-spawn hooks for setting environment variables and timeouts per test.
- Added support for passing spawn options to child test processes.
- Child processes are now clearly identified during test execution.
- Prevented hook and setup changes from unintentionally leaking between tests.
- Preserved scheduling and resource reservations even when test settings change.
- Added validation for invalid environment variable names and values.
- Expanded coverage for hook ordering, subprocess behavior, environment handling, and scheduler safety.
<!-- end of auto-generated comment: release notes by coderabbit.ai -->