diff --git a/.changes/unreleased/Fixes-20241209-150711.yaml b/.changes/unreleased/Fixes-20241209-150711.yaml new file mode 100644 index 00000000000..a9522145abe --- /dev/null +++ b/.changes/unreleased/Fixes-20241209-150711.yaml @@ -0,0 +1,6 @@ +kind: Fixes +body: Fix interpretation of `PartialSuccess` to result in non-zero exit code +time: 2024-12-09T15:07:11.391313-06:00 +custom: + Author: QMalcolm + Issue: "11114" diff --git a/core/dbt/task/runnable.py b/core/dbt/task/runnable.py index b889558d048..55342cafbbc 100644 --- a/core/dbt/task/runnable.py +++ b/core/dbt/task/runnable.py @@ -626,6 +626,7 @@ def interpret_results(cls, results): NodeStatus.Error, NodeStatus.Fail, NodeStatus.Skipped, # propogate error message causing skip + NodeStatus.PartialSuccess, # because partial success also means partial failure ) ] return len(failures) == 0 diff --git a/tests/functional/microbatch/test_microbatch.py b/tests/functional/microbatch/test_microbatch.py index 8567dbe67a4..c31657d94fc 100644 --- a/tests/functional/microbatch/test_microbatch.py +++ b/tests/functional/microbatch/test_microbatch.py @@ -613,7 +613,7 @@ def models(self): def test_run_with_event_time(self, project): # run all partitions from start - 2 expected rows in output, one failed with patch_microbatch_end_time("2020-01-03 13:57:00"): - _, console_output = run_dbt_and_capture(["run"]) + _, console_output = run_dbt_and_capture(["run"], expect_pass=False) assert "PARTIAL SUCCESS (2/3)" in console_output assert "Completed with 1 partial success" in console_output @@ -652,7 +652,7 @@ def models(self): def test_run_with_event_time(self, project): # run all partitions from start - 2 expected rows in output, one failed with patch_microbatch_end_time("2020-01-03 13:57:00"): - _, console_output = run_dbt_and_capture(["run"]) + _, console_output = run_dbt_and_capture(["run"], expect_pass=False) assert "PARTIAL SUCCESS (2/3)" in console_output assert "Completed with 1 partial success" in console_output @@ -751,7 +751,7 @@ def test_run_with_event_time(self, project): # run all partitions from start - 2 expected rows in output, one failed with patch_microbatch_end_time("2020-01-03 13:57:00"): - run_dbt(["run"], callbacks=[event_catcher.catch]) + run_dbt(["run"], expect_pass=False, callbacks=[event_catcher.catch]) assert len(event_catcher.caught_events) == 1 self.assert_row_count(project, "microbatch_model", 2)