Skip to content

Commit e4a77e1

Browse files
tests: use .test TLD for bare-hostname fixtures (#5220)
## Changes Rename bare-hostname test fixtures (no TLD) to use `.test`: - `libs/databrickscfg/profile/testdata/databrickscfg` — `https://default`, `https://query/?o=1234`, `https://foo` - `libs/databrickscfg/profile/testdata/sample-home/.databrickscfg` — `https://default` - `libs/databrickscfg/loader_test.go` — `Host:` fields and the `multiple profiles matched` error-message assertion - `libs/databrickscfg/ops_test.go` — only the two cases that match the renamed shared fixture profiles - `cmd/labs/project/testdata/installed-in-home/.databrickscfg` — `https://abc` `https://accounts.cloud.databricks.com` and `https://spog[-dup].databricks.com` in the same files are intentionally left as-is. ## Why Follow-up to #5189. That sweep replaced real `.com` hosts; this catches the bare-hostname variants the `.com` filter missed. The SDK well-known endpoint resolver treats single-label hosts as real DNS lookups, so these fixtures stall ~3s each on the Windows CI runner. From `test-output.json` of run 25496981743 (win-tf): | Test | linux | windows | |----------------------------------------------------------|--------|---------| | `TestLoaderSkipsExistingAuth` | 0.01s | 3.04s | | `TestLoaderSkipsExplicitAuthType` | 0.01s | 2.79s | | `TestLoaderMatchingHostWithQuery` | 0.03s | 2.78s | | `TestLoaderMatchingHost` | 0.00s | 2.76s | | `TestLoaderSkipsNonExistingConfigFile` | 0.01s | 2.75s | | `TestLoaderSkipsNoMatchingHost` | 0.01s | 1.27s | | `cmd/labs/project: TestRunningCommand` | 0.10s | 2.98s | | `cmd/labs/project: TestRenderingTable` | 0.03s | 2.92s | | `cmd/labs/project: TestRunningBlueprintEchoProfileWrong` | 0.01s | 2.76s | ~25s per Windows job × 2 engines = ~50s expected to come back. Scope is limited to fixtures that actually trigger the resolver. Other `https://foo`-style strings in `ops_test.go` are in tempdir-only tests that never hit DNS and remain untouched to keep the diff focused. ## Tests - `go test ./libs/databrickscfg/... ./cmd/labs/project/...` passes locally. - `./task fmt`, `./task checks`, `./task lint` all clean. - Watch the Windows-tf job duration on this PR — expect ~25–50s improvement. _This PR was written by Claude Code._
1 parent 83efe60 commit e4a77e1

5 files changed

Lines changed: 20 additions & 20 deletions

File tree

cmd/labs/project/testdata/installed-in-home/.databrickscfg

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -1,5 +1,5 @@
11
[workspace-profile]
2-
host = https://abc
2+
host = https://abc.test
33
token = bcd
44
cluster_id = cde
55
warehouse_id = def

libs/databrickscfg/loader_test.go

Lines changed: 10 additions & 10 deletions
Original file line numberDiff line numberDiff line change
@@ -26,7 +26,7 @@ func TestLoaderSkipsExistingAuth(t *testing.T) {
2626
Loaders: []config.Loader{
2727
ResolveProfileFromHost,
2828
},
29-
Host: "https://foo",
29+
Host: "https://foo.test",
3030
Token: "nonempty means pat auth",
3131
}
3232

@@ -40,7 +40,7 @@ func TestLoaderSkipsExplicitAuthType(t *testing.T) {
4040
ResolveProfileFromHost,
4141
},
4242
ConfigFile: "testdata/databrickscfg",
43-
Host: "https://default",
43+
Host: "https://default.test",
4444
AuthType: "azure-cli",
4545
}
4646

@@ -57,7 +57,7 @@ func TestLoaderSkipsNonExistingConfigFile(t *testing.T) {
5757
ResolveProfileFromHost,
5858
},
5959
ConfigFile: "idontexist",
60-
Host: "https://default",
60+
Host: "https://default.test",
6161
}
6262

6363
err := cfg.EnsureResolved()
@@ -71,7 +71,7 @@ func TestLoaderErrorsOnInvalidFile(t *testing.T) {
7171
ResolveProfileFromHost,
7272
},
7373
ConfigFile: "profile/testdata/badcfg",
74-
Host: "https://default",
74+
Host: "https://default.test",
7575
}
7676

7777
err := cfg.EnsureResolved()
@@ -84,7 +84,7 @@ func TestLoaderSkipsNoMatchingHost(t *testing.T) {
8484
ResolveProfileFromHost,
8585
},
8686
ConfigFile: "profile/testdata/databrickscfg",
87-
Host: "https://noneofthehostsmatch",
87+
Host: "https://noneofthehostsmatch.test",
8888
}
8989

9090
err := cfg.EnsureResolved()
@@ -98,7 +98,7 @@ func TestLoaderMatchingHost(t *testing.T) {
9898
ResolveProfileFromHost,
9999
},
100100
ConfigFile: "profile/testdata/databrickscfg",
101-
Host: "https://default",
101+
Host: "https://default.test",
102102
}
103103

104104
err := cfg.EnsureResolved()
@@ -113,7 +113,7 @@ func TestLoaderMatchingHostWithQuery(t *testing.T) {
113113
ResolveProfileFromHost,
114114
},
115115
ConfigFile: "profile/testdata/databrickscfg",
116-
Host: "https://query/?foo=bar",
116+
Host: "https://query.test/?foo=bar",
117117
}
118118

119119
err := cfg.EnsureResolved()
@@ -128,12 +128,12 @@ func TestLoaderErrorsOnMultipleMatches(t *testing.T) {
128128
ResolveProfileFromHost,
129129
},
130130
ConfigFile: "profile/testdata/databrickscfg",
131-
Host: "https://foo/bar",
131+
Host: "https://foo.test/bar",
132132
}
133133

134134
err := cfg.EnsureResolved()
135135
assert.Error(t, err)
136-
assert.ErrorContains(t, err, "https://foo: multiple profiles matched: foo1, foo2")
136+
assert.ErrorContains(t, err, "https://foo.test: multiple profiles matched: foo1, foo2")
137137
}
138138

139139
func TestAsMultipleProfilesExtractsNames(t *testing.T) {
@@ -142,7 +142,7 @@ func TestAsMultipleProfilesExtractsNames(t *testing.T) {
142142
ResolveProfileFromHost,
143143
},
144144
ConfigFile: "profile/testdata/databrickscfg",
145-
Host: "https://foo/bar",
145+
Host: "https://foo.test/bar",
146146
}
147147

148148
err := cfg.EnsureResolved()

libs/databrickscfg/ops_test.go

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -66,7 +66,7 @@ func TestMatchOrCreateSection_AccountID(t *testing.T) {
6666

6767
func TestMatchOrCreateSection_NormalizeHost(t *testing.T) {
6868
cfg := &config.Config{
69-
Host: "https://query/?o=abracadabra",
69+
Host: "https://query.test/?o=abracadabra",
7070
}
7171
file, err := loadOrCreateConfigFile(t.Context(), "profile/testdata/databrickscfg")
7272
assert.NoError(t, err)
@@ -90,7 +90,7 @@ func TestMatchOrCreateSection_NoProfileOrHost(t *testing.T) {
9090

9191
func TestMatchOrCreateSection_MultipleProfiles(t *testing.T) {
9292
cfg := &config.Config{
93-
Host: "https://foo",
93+
Host: "https://foo.test",
9494
}
9595
file, err := loadOrCreateConfigFile(t.Context(), "profile/testdata/databrickscfg")
9696
assert.NoError(t, err)

libs/databrickscfg/profile/testdata/databrickscfg

Lines changed: 6 additions & 6 deletions
Original file line numberDiff line numberDiff line change
@@ -1,26 +1,26 @@
11
[DEFAULT]
2-
host = https://default
2+
host = https://default.test
33
token = default
44

55
[query]
6-
host = https://query/?o=1234
6+
host = https://query.test/?o=1234
77
token = query
88

99
[nohost]
1010
token = query
1111

12-
# Duplicate entry for https://foo
12+
# Duplicate entry for https://foo.test
1313
[foo1]
14-
host = https://foo
14+
host = https://foo.test
1515
token = foo1
1616

1717
[acc]
1818
host = https://accounts.cloud.databricks.com
1919
account_id = abc
2020

21-
# Duplicate entry for https://foo
21+
# Duplicate entry for https://foo.test
2222
[foo2]
23-
host = https://foo
23+
host = https://foo.test
2424
token = foo2
2525

2626
# SPOG profiles sharing the same host but with different workspace_ids

libs/databrickscfg/profile/testdata/sample-home/.databrickscfg

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -1,5 +1,5 @@
11
[DEFAULT]
2-
host = https://default
2+
host = https://default.test
33
token = default
44

55
[acc]

0 commit comments

Comments
 (0)