Skip to content

Commit 8700f30

Browse files
committed
Drive cmd.Env from t.Setenv in endtoend tests
Mirror how the real CLI populates cmd.Env: t.Setenv every entry from exec.json's Env map and then call opts.DebugFromEnv/ExperimentFromEnv. This generalises to any env var a test wants to set (not just SQLCDEBUG/SQLCEXPERIMENT) and keeps the test path closer to the production code path. https://claude.ai/code/session_01RCzB2JR5Y5ScFDUmwcxGVZ
1 parent 454dd7a commit 8700f30

1 file changed

Lines changed: 5 additions & 2 deletions

File tree

internal/endtoend/endtoend_test.go

Lines changed: 5 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -338,10 +338,13 @@ func TestReplay(t *testing.T) {
338338
}
339339

340340
cfg := testctx.Config(t, path)
341+
for k, v := range args.Env {
342+
t.Setenv(k, v)
343+
}
341344
cmdOpts := cmd.Options{
342345
Env: cmd.Env{
343-
Debug: opts.DebugFromString(args.Env["SQLCDEBUG"]),
344-
Experiment: opts.ExperimentFromString(args.Env["SQLCEXPERIMENT"]),
346+
Debug: opts.DebugFromEnv(),
347+
Experiment: opts.ExperimentFromEnv(),
345348
},
346349
Stderr: &stderr,
347350
}

0 commit comments

Comments
 (0)