2023-09-08 15:37:55 +00:00
|
|
|
package config_tests
|
|
|
|
|
|
|
|
import (
|
|
|
|
"path/filepath"
|
|
|
|
"testing"
|
|
|
|
|
2024-07-01 09:01:10 +00:00
|
|
|
"github.com/databricks/cli/cmd/root"
|
|
|
|
assert "github.com/databricks/cli/libs/dyn/dynassert"
|
|
|
|
|
2023-09-08 15:37:55 +00:00
|
|
|
"github.com/databricks/cli/internal"
|
|
|
|
)
|
|
|
|
|
|
|
|
func TestSuggestTargetIfWrongPassed(t *testing.T) {
|
|
|
|
t.Setenv("BUNDLE_ROOT", filepath.Join("target_overrides", "workspace"))
|
2024-07-01 09:01:10 +00:00
|
|
|
stdoutBytes, _, err := internal.RequireErrorRun(t, "bundle", "validate", "-e", "incorrect")
|
|
|
|
stdout := stdoutBytes.String()
|
|
|
|
|
|
|
|
assert.Error(t, root.ErrAlreadyPrinted, err)
|
|
|
|
assert.Contains(t, stdout, "Available targets:")
|
|
|
|
assert.Contains(t, stdout, "development")
|
|
|
|
assert.Contains(t, stdout, "staging")
|
2023-09-08 15:37:55 +00:00
|
|
|
}
|