Select explicit config fixtures in login flow tests
1 file changed,
+8
−4
apimode_test.go+8 −4
CI failed — run details
diff --git a/apimode_test.go b/apimode_test.go| index df68f7251..22d6db970 100644 |
| --- a/apimode_test.go |
| +++ b/apimode_test.go |
| @@ -3427,6 +3427,7 @@ func TestConsoleMovedOfferLogsInAndRepointsConfig(t *testing.T) { |
| })) |
| t.Cleanup(old.Close) |
| cfgPath := writeConfig(t, ".", `{"console": "`+old.URL+`", "account": "acme"}`) |
| + t.Setenv("CARLOS_CONFIG", cfgPath) |
| oldIn := chooserIn |
| chooserIn = strings.NewReader("y\ny\n") // log in? yes. repoint config? yes. |
| t.Cleanup(func() { chooserIn = oldIn }) |
| @@ -3514,7 +3515,8 @@ func TestResolveModeOffersLoginAndContinues(t *testing.T) { |
| captureStdout(t) |
| forceTerminal(t, true) |
| fc := newFakeConsole(t) |
| - writeConfig(t, ".", `{"console": "`+fc.ts.URL+`"}`) |
| + cfgPath := writeConfig(t, ".", `{"console": "`+fc.ts.URL+`"}`) |
| + t.Setenv("CARLOS_CONFIG", cfgPath) |
| oldIn := chooserIn |
| chooserIn = strings.NewReader("y\n") |
| t.Cleanup(func() { chooserIn = oldIn }) |
| @@ -3534,7 +3536,8 @@ func TestResolveModeOfferDeclinedKeepsTheError(t *testing.T) { |
| captureStdout(t) |
| forceTerminal(t, true) |
| fc := newFakeConsole(t) |
| - writeConfig(t, ".", `{"console": "`+fc.ts.URL+`"}`) |
| + cfgPath := writeConfig(t, ".", `{"console": "`+fc.ts.URL+`"}`) |
| + t.Setenv("CARLOS_CONFIG", cfgPath) |
| oldIn := chooserIn |
| chooserIn = strings.NewReader("n\n") |
| t.Cleanup(func() { chooserIn = oldIn }) |
| @@ -3552,7 +3555,8 @@ func TestResolveModeNonTTYErrorsUnchanged(t *testing.T) { |
| captureStdout(t) |
| forceTerminal(t, false) |
| fc := newFakeConsole(t) |
| - writeConfig(t, ".", `{"console": "`+fc.ts.URL+`"}`) |
| + cfgPath := writeConfig(t, ".", `{"console": "`+fc.ts.URL+`"}`) |
| + t.Setenv("CARLOS_CONFIG", cfgPath) |
| // No prompt machinery runs at all: scripts get the string they have |
| // always matched. |
| @@ -3562,7 +3566,7 @@ func TestResolveModeNonTTYErrorsUnchanged(t *testing.T) { |
| } |
| // And the nothing-configured case keeps ITS exact wording too. |
| - os.RemoveAll(".carlos") |
| + os.Remove(cfgPath) |
| if _, err := resolveMode(""); err == nil || |
| !strings.Contains(err.Error(), "no deployment target configured") { |
| t.Fatalf("non-TTY unconfigured = %v", err) |