2023-09-08 15:37:55 +00:00
|
|
|
package config_tests
|
|
|
|
|
|
|
|
import (
|
2024-12-12 16:48:51 +00:00
|
|
|
"context"
|
2023-09-08 15:37:55 +00:00
|
|
|
"testing"
|
|
|
|
|
2024-12-12 16:48:51 +00:00
|
|
|
"github.com/databricks/cli/bundle"
|
|
|
|
"github.com/databricks/cli/bundle/config/mutator"
|
|
|
|
"github.com/stretchr/testify/require"
|
2023-09-08 15:37:55 +00:00
|
|
|
)
|
|
|
|
|
|
|
|
func TestSuggestTargetIfWrongPassed(t *testing.T) {
|
2024-12-12 16:48:51 +00:00
|
|
|
b := load(t, "target_overrides/workspace")
|
2024-07-01 09:01:10 +00:00
|
|
|
|
2024-12-12 16:48:51 +00:00
|
|
|
ctx := context.Background()
|
|
|
|
diags := bundle.Apply(ctx, b, mutator.SelectTarget("incorrect"))
|
|
|
|
err := diags.Error()
|
|
|
|
require.Error(t, err)
|
|
|
|
require.Contains(t, err.Error(), "Available targets:")
|
|
|
|
require.Contains(t, err.Error(), "development")
|
|
|
|
require.Contains(t, err.Error(), "staging")
|
2023-09-08 15:37:55 +00:00
|
|
|
}
|