Skip to content

Commit abcf45d

Browse files
committed
rename RequireOutput to AssertOutput
1 parent ca24b15 commit abcf45d

File tree

2 files changed

+11
-12
lines changed

2 files changed

+11
-12
lines changed

integration/bundle/init_default_python_test.go

Lines changed: 5 additions & 6 deletions
Original file line numberDiff line numberDiff line change
@@ -88,17 +88,17 @@ func testDefaultPython(t *testing.T, pythonVersion string) {
8888
err = os.WriteFile(filepath.Join(tmpDir, "config.json"), b, 0o644)
8989
require.NoError(t, err)
9090

91-
testcli.RequireOutput(t, ctx, []string{"bundle", "init", "default-python", "--config-file", "config.json"}, "testdata/default_python/bundle_init.txt")
91+
testcli.AssertOutput(t, ctx, []string{"bundle", "init", "default-python", "--config-file", "config.json"}, "testdata/default_python/bundle_init.txt")
9292
testutil.Chdir(t, projectName)
9393

94-
testcli.RequireOutput(t, ctx, []string{"bundle", "validate"}, "testdata/default_python/bundle_validate.txt")
95-
96-
testcli.RequireOutput(t, ctx, []string{"bundle", "deploy"}, "testdata/default_python/bundle_deploy.txt")
9794
t.Cleanup(func() {
9895
// Delete the stack
9996
testcli.RequireSuccessfulRun(t, ctx, "bundle", "destroy", "--auto-approve")
10097
})
10198

99+
testcli.AssertOutput(t, ctx, []string{"bundle", "validate"}, "testdata/default_python/bundle_validate.txt")
100+
testcli.AssertOutput(t, ctx, []string{"bundle", "deploy"}, "testdata/default_python/bundle_deploy.txt")
101+
102102
ignoredFields := []string{
103103
"/bundle/terraform/exec_path",
104104
"/resources/jobs/project_name_$UNIQUE_PRJ_job/email_notifications",
@@ -108,6 +108,5 @@ func testDefaultPython(t *testing.T, pythonVersion string) {
108108
"/resources/pipelines/project_name_$UNIQUE_PRJ_pipeline/url",
109109
"/workspace/current_user",
110110
}
111-
112-
testcli.RequireOutputJQ(t, ctx, []string{"bundle", "summary", "--output", "json"}, "testdata/default_python/bundle_summary.txt", ignoredFields)
111+
testcli.AssertOutputJQ(t, ctx, []string{"bundle", "summary", "--output", "json"}, "testdata/default_python/bundle_summary.txt", ignoredFields)
113112
}

internal/testcli/golden.go

Lines changed: 6 additions & 6 deletions
Original file line numberDiff line numberDiff line change
@@ -16,7 +16,7 @@ import (
1616
"github.com/databricks/cli/libs/testdiff"
1717
"github.com/databricks/databricks-sdk-go"
1818
"github.com/databricks/databricks-sdk-go/service/iam"
19-
"github.com/stretchr/testify/require"
19+
"github.com/stretchr/testify/assert"
2020
)
2121

2222
var OverwriteMode = os.Getenv("TESTS_OUTPUT") == "OVERWRITE"
@@ -26,7 +26,7 @@ func ReadFile(t testutil.TestingT, ctx context.Context, filename string) string
2626
if os.IsNotExist(err) {
2727
return ""
2828
}
29-
require.NoError(t, err)
29+
assert.NoError(t, err)
3030
// On CI, on Windows \n in the file somehow end up as \r\n
3131
return NormalizeNewlines(string(data))
3232
}
@@ -35,18 +35,18 @@ func captureOutput(t testutil.TestingT, ctx context.Context, args []string) stri
3535
t.Logf("run args: [%s]", strings.Join(args, ", "))
3636
r := NewRunner(t, ctx, args...)
3737
stdout, stderr, err := r.Run()
38-
require.NoError(t, err)
38+
assert.NoError(t, err)
3939
out := stderr.String() + stdout.String()
4040
return ReplaceOutput(t, ctx, out)
4141
}
4242

4343
func WriteFile(t testutil.TestingT, filename, data string) {
4444
t.Logf("Overwriting %s", filename)
4545
err := os.WriteFile(filename, []byte(data), 0o644)
46-
require.NoError(t, err)
46+
assert.NoError(t, err)
4747
}
4848

49-
func RequireOutput(t testutil.TestingT, ctx context.Context, args []string, expectedFilename string) {
49+
func AssertOutput(t testutil.TestingT, ctx context.Context, args []string, expectedFilename string) {
5050
_, filename, _, _ := runtime.Caller(1)
5151
dir := filepath.Dir(filename)
5252
expectedPath := filepath.Join(dir, expectedFilename)
@@ -64,7 +64,7 @@ func RequireOutput(t testutil.TestingT, ctx context.Context, args []string, expe
6464
}
6565
}
6666

67-
func RequireOutputJQ(t testutil.TestingT, ctx context.Context, args []string, expectedFilename string, ignorePaths []string) {
67+
func AssertOutputJQ(t testutil.TestingT, ctx context.Context, args []string, expectedFilename string, ignorePaths []string) {
6868
_, filename, _, _ := runtime.Caller(1)
6969
dir := filepath.Dir(filename)
7070
expectedPath := filepath.Join(dir, expectedFilename)

0 commit comments

Comments
 (0)