Skip to content

Commit

Permalink
Fix tests
Browse files Browse the repository at this point in the history
  • Loading branch information
kanterov committed Jun 27, 2024
1 parent 7b2fb10 commit 7e964f7
Showing 1 changed file with 9 additions and 5 deletions.
14 changes: 9 additions & 5 deletions bundle/tests/suggest_target_test.go
Original file line number Diff line number Diff line change
@@ -1,17 +1,21 @@
package config_tests

import (
"github.com/databricks/cli/cmd/root"
assert "github.com/databricks/cli/libs/dyn/dynassert"
"path/filepath"
"testing"

"github.com/databricks/cli/internal"
"github.com/stretchr/testify/require"
)

func TestSuggestTargetIfWrongPassed(t *testing.T) {
t.Setenv("BUNDLE_ROOT", filepath.Join("target_overrides", "workspace"))
_, _, err := internal.RequireErrorRun(t, "bundle", "validate", "-e", "incorrect")
require.ErrorContains(t, err, "Available targets:")
require.ErrorContains(t, err, "development")
require.ErrorContains(t, err, "staging")
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")
}

0 comments on commit 7e964f7

Please sign in to comment.