e2e: subprocess env must not see the operator's real ~/.carlos
TestAccountsCLI inherited the developer's $HOME, so a genuine login on the machine made ownerless `accounts create` succeed and fail the test. Scrub HOME/CARLOS_CREDENTIALS/CARLOS_CONSOLE from every carlos subprocess env that consults credentials.
Co-Authored-By: Claude Fable 5 <noreply@anthropic.com> Claude-Session: https://claude.ai/code/session_01KxXEWoRXU8WVTXjTJypuJ5
1 file changed,
+11
−1
e2e_test.go+11 −1
diff --git a/e2e_test.go b/e2e_test.go| index ec7c817f9..89934bee9 100644 |
| --- a/e2e_test.go |
| +++ b/e2e_test.go |
| @@ -685,7 +685,17 @@ func TestAccountsCLI(t *testing.T) { |
| } |
| storeDir := filepath.Join(tmp, "store") |
| regPath := filepath.Join(tmp, "registry.db") |
| - env := append(os.Environ(), "CARLOS_DEPLOYMENT_DIR="+storeDir) |
| + // The subprocess must never see the operator's real ~/.carlos — a genuine |
| + // login on the developer's machine makes ownerless `accounts create` |
| + // succeed (the logged-in identity becomes the owner, by design) and |
| + // flips this test's answer. os/exec keeps the LAST duplicate key, so |
| + // appending overrides the inherited values. |
| + env := append(os.Environ(), |
| + "CARLOS_DEPLOYMENT_DIR="+storeDir, |
| + "HOME="+tmp, |
| + "CARLOS_CREDENTIALS="+filepath.Join(tmp, "no-credentials"), |
| + "CARLOS_CONSOLE=", |
| + ) |
| run := func(args ...string) string { |
| t.Helper() |
| cmd := exec.Command(carlosBin, args...) |