Skip to content
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
2 changes: 1 addition & 1 deletion cmd/labs/project/testdata/installed-in-home/.databrickscfg
Original file line number Diff line number Diff line change
@@ -1,5 +1,5 @@
[workspace-profile]
host = https://abc
host = https://abc.test
token = bcd
cluster_id = cde
warehouse_id = def
Expand Down
20 changes: 10 additions & 10 deletions libs/databrickscfg/loader_test.go
Original file line number Diff line number Diff line change
Expand Up @@ -26,7 +26,7 @@ func TestLoaderSkipsExistingAuth(t *testing.T) {
Loaders: []config.Loader{
ResolveProfileFromHost,
},
Host: "https://foo",
Host: "https://foo.test",
Token: "nonempty means pat auth",
}

Expand All @@ -40,7 +40,7 @@ func TestLoaderSkipsExplicitAuthType(t *testing.T) {
ResolveProfileFromHost,
},
ConfigFile: "testdata/databrickscfg",
Host: "https://default",
Host: "https://default.test",
AuthType: "azure-cli",
}

Expand All @@ -57,7 +57,7 @@ func TestLoaderSkipsNonExistingConfigFile(t *testing.T) {
ResolveProfileFromHost,
},
ConfigFile: "idontexist",
Host: "https://default",
Host: "https://default.test",
}

err := cfg.EnsureResolved()
Expand All @@ -71,7 +71,7 @@ func TestLoaderErrorsOnInvalidFile(t *testing.T) {
ResolveProfileFromHost,
},
ConfigFile: "profile/testdata/badcfg",
Host: "https://default",
Host: "https://default.test",
}

err := cfg.EnsureResolved()
Expand All @@ -84,7 +84,7 @@ func TestLoaderSkipsNoMatchingHost(t *testing.T) {
ResolveProfileFromHost,
},
ConfigFile: "profile/testdata/databrickscfg",
Host: "https://noneofthehostsmatch",
Host: "https://noneofthehostsmatch.test",
}

err := cfg.EnsureResolved()
Expand All @@ -98,7 +98,7 @@ func TestLoaderMatchingHost(t *testing.T) {
ResolveProfileFromHost,
},
ConfigFile: "profile/testdata/databrickscfg",
Host: "https://default",
Host: "https://default.test",
}

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

err := cfg.EnsureResolved()
Expand All @@ -128,12 +128,12 @@ func TestLoaderErrorsOnMultipleMatches(t *testing.T) {
ResolveProfileFromHost,
},
ConfigFile: "profile/testdata/databrickscfg",
Host: "https://foo/bar",
Host: "https://foo.test/bar",
}

err := cfg.EnsureResolved()
assert.Error(t, err)
assert.ErrorContains(t, err, "https://foo: multiple profiles matched: foo1, foo2")
assert.ErrorContains(t, err, "https://foo.test: multiple profiles matched: foo1, foo2")
}

func TestAsMultipleProfilesExtractsNames(t *testing.T) {
Expand All @@ -142,7 +142,7 @@ func TestAsMultipleProfilesExtractsNames(t *testing.T) {
ResolveProfileFromHost,
},
ConfigFile: "profile/testdata/databrickscfg",
Host: "https://foo/bar",
Host: "https://foo.test/bar",
}

err := cfg.EnsureResolved()
Expand Down
4 changes: 2 additions & 2 deletions libs/databrickscfg/ops_test.go
Original file line number Diff line number Diff line change
Expand Up @@ -66,7 +66,7 @@ func TestMatchOrCreateSection_AccountID(t *testing.T) {

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

func TestMatchOrCreateSection_MultipleProfiles(t *testing.T) {
cfg := &config.Config{
Host: "https://foo",
Host: "https://foo.test",
}
file, err := loadOrCreateConfigFile(t.Context(), "profile/testdata/databrickscfg")
assert.NoError(t, err)
Expand Down
12 changes: 6 additions & 6 deletions libs/databrickscfg/profile/testdata/databrickscfg
Original file line number Diff line number Diff line change
@@ -1,26 +1,26 @@
[DEFAULT]
host = https://default
host = https://default.test
token = default

[query]
host = https://query/?o=1234
host = https://query.test/?o=1234
token = query

[nohost]
token = query

# Duplicate entry for https://foo
# Duplicate entry for https://foo.test
[foo1]
host = https://foo
host = https://foo.test
token = foo1

[acc]
host = https://accounts.cloud.databricks.com
account_id = abc

# Duplicate entry for https://foo
# Duplicate entry for https://foo.test
[foo2]
host = https://foo
host = https://foo.test
token = foo2

# SPOG profiles sharing the same host but with different workspace_ids
Expand Down
Original file line number Diff line number Diff line change
@@ -1,5 +1,5 @@
[DEFAULT]
host = https://default
host = https://default.test
token = default

[acc]
Expand Down
Loading