Fix tests under ./cmd/configure if DATABRICKS_TOKEN is set (#605)

## Changes

The assertions would fail because `DATABRICKS_TOKEN` overrides a token
set in the profile.

## Tests

Tests now pass if `DATABRICKS_TOKEN` is set.
This commit is contained in:
Pieter Noordhuis 2023-07-26 11:37:18 +02:00 committed by GitHub
parent 5e0a096722
commit f0ad28ab62
No known key found for this signature in database
GPG Key ID: 4AEE18F83AFDEB23
1 changed files with 4 additions and 2 deletions

View File

@ -14,8 +14,9 @@ import (
func assertKeyValueInSection(t *testing.T, section *ini.Section, keyName, expectedValue string) { func assertKeyValueInSection(t *testing.T, section *ini.Section, keyName, expectedValue string) {
key, err := section.GetKey(keyName) key, err := section.GetKey(keyName)
assert.NoError(t, err) if assert.NoError(t, err) {
assert.Equal(t, key.Value(), expectedValue) assert.Equal(t, expectedValue, key.Value())
}
} }
func setup(t *testing.T) string { func setup(t *testing.T) string {
@ -26,6 +27,7 @@ func setup(t *testing.T) string {
} }
t.Setenv(homeEnvVar, tempHomeDir) t.Setenv(homeEnvVar, tempHomeDir)
t.Setenv("DATABRICKS_CONFIG_FILE", "") t.Setenv("DATABRICKS_CONFIG_FILE", "")
t.Setenv("DATABRICKS_TOKEN", "")
return tempHomeDir return tempHomeDir
} }