Skip to content

Commit 2f3127f

Browse files
fix(runtime): honor configured env in default tests
1 parent 4fdaa49 commit 2f3127f

1 file changed

Lines changed: 22 additions & 1 deletion

File tree

‎pkg/runtime/runtime.go‎

Lines changed: 22 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -183,7 +183,12 @@ func (s *Runtime) Test(ctx context.Context, req *runtimev0.TestRequest) (*runtim
183183
}
184184

185185
started := time.Now()
186-
run, runErr := pythonhelpers.RunPythonTestsStructured(ctx, s.Service.SourceLocation, nil, opts)
186+
run, runErr := pythonhelpers.RunPythonTestsStructured(
187+
ctx,
188+
s.Service.SourceLocation,
189+
configuredTestEnvironment(s.Base.Service),
190+
opts,
191+
)
187192
duration := time.Since(started)
188193

189194
if run == nil {
@@ -220,6 +225,22 @@ func configuredTestEnvKeys(service *resources.Service) []string {
220225
return keys
221226
}
222227

228+
// configuredTestEnvironment projects the persisted, plugin-owned test
229+
// environment into the shared default runner. Formula-driven runs already
230+
// receive this map through SpecFromFormula; the default runner must honor the
231+
// same configuration contract instead of silently dropping recovery state.
232+
func configuredTestEnvironment(service *resources.Service) []*resources.EnvironmentVariable {
233+
keys := configuredTestEnvKeys(service)
234+
if len(keys) == 0 {
235+
return nil
236+
}
237+
variables := make([]*resources.EnvironmentVariable, 0, len(keys))
238+
for _, key := range keys {
239+
variables = append(variables, &resources.EnvironmentVariable{Key: key, Value: service.Test.Env[key]})
240+
}
241+
return variables
242+
}
243+
223244
// testResponseLogSummary renders the structured runtime verdict rather than
224245
// the legacy case counters alone. Zero-case environment failures and healthy
225246
// materialization probes both have zero passing tests; logging either as

0 commit comments

Comments
 (0)