Skip to content

Commit a377aca

Browse files
committed
Fix TestCheckAuthSuccess to work in CI
The test used env.Set(ctx, ...) to set DATABRICKS_HOST and DATABRICKS_TOKEN, but checkAuth creates a bare config.Config{} that reads from real environment variables via os.Getenv, not the context-based env layer. Use t.Setenv instead so the SDK can see the values. Co-authored-by: Isaac
1 parent 8c0a915 commit a377aca

1 file changed

Lines changed: 5 additions & 4 deletions

File tree

cmd/doctor/doctor_test.go

Lines changed: 5 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -168,11 +168,12 @@ func TestCheckAuthSuccess(t *testing.T) {
168168
}))
169169
defer srv.Close()
170170

171+
t.Setenv("DATABRICKS_HOST", srv.URL)
172+
t.Setenv("DATABRICKS_TOKEN", "test-token")
173+
t.Setenv("DATABRICKS_CONFIG_PROFILE", "")
174+
t.Setenv("HOME", t.TempDir())
175+
171176
ctx := cmdio.MockDiscard(t.Context())
172-
ctx = env.Set(ctx, "DATABRICKS_HOST", srv.URL)
173-
ctx = env.Set(ctx, "DATABRICKS_TOKEN", "test-token")
174-
ctx = env.Set(ctx, "DATABRICKS_CONFIG_PROFILE", "")
175-
ctx = env.Set(ctx, "HOME", t.TempDir())
176177
cmd := newTestCmd(ctx)
177178

178179
result, w := checkAuth(cmd)

0 commit comments

Comments
 (0)