Skip to content

Commit cae44ca

Browse files
tharunbhuk-dbIsaac
andcommitted
Assert required pipelines test failures with musterr and inline appends
The test-ids acceptance test expects both runs of the split pipeline to fail, so it uses musterr instead of errcode. The raw requests test appends inline instead of through a closure that only names the append. Co-authored-by: Isaac <no-reply@databricks.com>
1 parent 5dbb1c0 commit cae44ca

3 files changed

Lines changed: 6 additions & 11 deletions

File tree

‎acceptance/pipelines/test/test-ids/output.txt‎

Lines changed: 1 addition & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -65,7 +65,7 @@ tests/test_a.py::test_one PASSED (1.00s)
6565
=== With tests outside root_path, a failing test ID printed in a subfolder runs again from there
6666
Printed: tests/test_returns.py::test_returned_fails
6767

68-
>>> errcode [CLI] pipelines test split tests/test_returns.py::test_returned_fails
68+
>>> musterr [CLI] pipelines test split tests/test_returns.py::test_returned_fails
6969
Recommendation: This command runs the last deployed version of the code
7070

7171
If you've made local changes, run 'databricks pipelines deploy' first to ensure they are included.
@@ -82,7 +82,5 @@ tests/test_returns.py::test_returned_fails
8282

8383
1 test: 0 passed, 1 failed, 0 skipped, 0 errors
8484

85-
Exit code: 1
86-
8785
>>> print_requests.py //updates
8886
{"test_selection":["/Workspace/Users/[USERNAME]/.bundle/test-pipeline-test-ids/default/files/tests/test_returns.py::test_returned_fails"]}

‎acceptance/pipelines/test/test-ids/script‎

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -17,10 +17,10 @@ trace print_requests.py //updates | jq -c .body.test_options
1717

1818
title "With tests outside root_path, a failing test ID printed in a subfolder runs again from there\n"
1919
cd src/split
20-
errcode $CLI pipelines test split > out.txt 2>&1
20+
musterr $CLI pipelines test split > out.txt 2>&1
2121
failed_id=$(grep -o '^[^ ]*::test_returned_fails' out.txt | head -1)
2222
rm out.txt "$OUT_REQUESTS"
2323
echo "Printed: $failed_id"
24-
trace errcode $CLI pipelines test split "$failed_id"
24+
trace musterr $CLI pipelines test split "$failed_id"
2525
cd ../..
2626
trace print_requests.py //updates | jq -c .body.test_options

‎bundle/direct/dresources/pipeline_test.go‎

Lines changed: 3 additions & 6 deletions
Original file line numberDiff line numberDiff line change
@@ -61,16 +61,13 @@ func TestPipelineOverrideChangeDescCascadeOnDestroy(t *testing.T) {
6161
func TestPipelineRawRequests(t *testing.T) {
6262
server := testserver.New(t)
6363
var bodies, workspaceIDs []string
64-
record := func(req testserver.Request) {
64+
server.Handle("POST", "/api/2.0/pipelines", func(req testserver.Request) any {
6565
bodies = append(bodies, string(req.Body))
6666
workspaceIDs = append(workspaceIDs, req.Headers.Get(auth.WorkspaceIDHeader))
67-
}
68-
server.Handle("POST", "/api/2.0/pipelines", func(req testserver.Request) any {
69-
record(req)
7067
return pipelines.CreatePipelineResponse{PipelineId: "p1"}
7168
})
7269
server.Handle("GET", "/api/2.0/pipelines/{pipeline_id}", func(req testserver.Request) any {
73-
record(req)
70+
workspaceIDs = append(workspaceIDs, req.Headers.Get(auth.WorkspaceIDHeader))
7471
return map[string]any{"pipeline_id": "p1", "spec": map[string]any{"name": "orders"}}
7572
})
7673
w, err := databricks.NewWorkspaceClient(&databricks.Config{Host: server.URL, Token: "token", WorkspaceID: "123"})
@@ -88,7 +85,7 @@ func TestPipelineRawRequests(t *testing.T) {
8885

8986
// The raw requests carry the workspace ID, as the SDK's do.
9087
assert.Equal(t, []string{"123", "123", "123"}, workspaceIDs)
91-
assert.JSONEq(t, `{"name": "orders"}`, bodies[2])
88+
assert.JSONEq(t, `{"name": "orders"}`, bodies[1])
9289
}
9390

9491
func TestPipelineReadReturnsTesting(t *testing.T) {

0 commit comments

Comments
 (0)