Skip to content

Commit 045fb9f

Browse files
committed
report the same test status as dbt
1 parent b7fdb6c commit 045fb9f

File tree

2 files changed

+17
-1
lines changed

2 files changed

+17
-1
lines changed

integration_tests/tests/test_failed_row_count.py

Lines changed: 16 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -54,3 +54,19 @@ def test_custom_failed_row_count(test_id: str, dbt_project: DbtProject):
5454
)
5555
assert test_result["status"] == "fail"
5656
assert test_result["failed_row_count"] == overwrite_failed_row_count
57+
58+
59+
def test_warn_if_0(test_id: str, dbt_project: DbtProject):
60+
# Edge case that we want to verify
61+
62+
null_count = 50
63+
data = [{COLUMN_NAME: "pasten"} for _ in range(null_count)]
64+
test_result = dbt_project.test(
65+
test_id,
66+
"not_null",
67+
dict(column_name=COLUMN_NAME, warn_if="=0"),
68+
data=data,
69+
test_vars={"enable_elementary_test_materialization": True},
70+
)
71+
assert test_result["status"] == "warn"
72+
assert test_result["failed_row_count"] == 0

macros/edr/tests/on_run_end/handle_tests_results.sql

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -41,7 +41,7 @@
4141

4242
{% for elementary_test_results_row in elementary_test_results_rows %}
4343
{% set failures = elementary_test_results_row.get("failures", result.failures) %}
44-
{% set status = "pass" if failures == 0 else result.status %}
44+
{% set status = result.status %}
4545
{% do elementary_test_results_row.update({'status': status, 'failures': failures, 'invocation_id': invocation_id,
4646
'failed_row_count': elementary_test_failed_row_count}) %}
4747
{% do elementary_test_results_row.setdefault('test_results_description', result.message) %}

0 commit comments

Comments
 (0)