From 1517de9c8250f3b979a3346012b00b5aafd552a6 Mon Sep 17 00:00:00 2001 From: tbog357 <103108711+tbog357@users.noreply.github.com> Date: Sun, 25 Feb 2024 13:55:40 +0700 Subject: [PATCH 1/5] Feat: populate failures even test are passed --- core/dbt/task/test.py | 1 + 1 file changed, 1 insertion(+) diff --git a/core/dbt/task/test.py b/core/dbt/task/test.py index 9548f633eb7..5bcfc457ab1 100644 --- a/core/dbt/task/test.py +++ b/core/dbt/task/test.py @@ -278,6 +278,7 @@ def build_test_run_result(self, test: TestNode, result: TestResultData) -> RunRe failures = result.failures else: status = TestStatus.Pass + failures = result.failures run_result = RunResult( node=test, From 21d0000be89e2671f5f9ab44dba738c3244ea2c0 Mon Sep 17 00:00:00 2001 From: tbog Date: Sat, 23 Mar 2024 17:21:51 +0700 Subject: [PATCH 2/5] Ref: add changelog entry file --- .changes/unreleased/Features-20240323-172105.yaml | 6 ++++++ 1 file changed, 6 insertions(+) create mode 100644 .changes/unreleased/Features-20240323-172105.yaml diff --git a/.changes/unreleased/Features-20240323-172105.yaml b/.changes/unreleased/Features-20240323-172105.yaml new file mode 100644 index 00000000000..182dcda55ee --- /dev/null +++ b/.changes/unreleased/Features-20240323-172105.yaml @@ -0,0 +1,6 @@ +kind: Features +body: Populate failures in run_results.json even tests passed +time: 2024-03-23T17:21:05.10213675+07:00 +custom: + Author: tbog357 + Issue: "9808" From d509f513366fe055cd1adec6df890ea012d4e922 Mon Sep 17 00:00:00 2001 From: Doug Beatty <44704949+dbeatty10@users.noreply.github.com> Date: Wed, 3 Apr 2024 08:16:18 -0600 Subject: [PATCH 3/5] Update changelog description --- .changes/unreleased/Features-20240323-172105.yaml | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/.changes/unreleased/Features-20240323-172105.yaml b/.changes/unreleased/Features-20240323-172105.yaml index 182dcda55ee..d7bd2b49e7d 100644 --- a/.changes/unreleased/Features-20240323-172105.yaml +++ b/.changes/unreleased/Features-20240323-172105.yaml @@ -1,5 +1,5 @@ kind: Features -body: Populate failures in run_results.json even tests passed +body: Populate actual count of failures in `run_results.json` for passing tests time: 2024-03-23T17:21:05.10213675+07:00 custom: Author: tbog357 From b4e95daadaa67bf03da5cfc67af6dede7eefefea Mon Sep 17 00:00:00 2001 From: tbog Date: Sun, 8 Sep 2024 12:05:35 +0700 Subject: [PATCH 4/5] Ref: update test cases for schema --- .../functional/schema_tests/test_schema_v2_tests.py | 12 ++++++------ 1 file changed, 6 insertions(+), 6 deletions(-) diff --git a/tests/functional/schema_tests/test_schema_v2_tests.py b/tests/functional/schema_tests/test_schema_v2_tests.py index 34286d82532..3f16f729ffb 100644 --- a/tests/functional/schema_tests/test_schema_v2_tests.py +++ b/tests/functional/schema_tests/test_schema_v2_tests.py @@ -125,7 +125,7 @@ def assertTestFailed(self, result): def assertTestPassed(self, result): assert result.status == "pass" assert not result.skipped - assert result.failures == 0, "test {} failed".format(result.node.name) + assert result.failures >= 0, "test {} failed".format(result.node.name) def test_schema_tests( self, @@ -212,7 +212,7 @@ def assertTestWarn(self, result): def assertTestPassed(self, result): assert result.status == "pass" assert not result.skipped - assert result.failures == 0, "test {} failed".format(result.node.name) + assert result.failures >= 0, "test {} failed".format(result.node.name) def test_limit_schema_tests( self, @@ -263,7 +263,7 @@ def assertTestWarn(self, result): def assertTestPassed(self, result): assert result.status == "pass" assert not result.skipped - assert result.failures == 0, "test {} failed".format(result.node.name) + assert result.failures >= 0, "test {} failed".format(result.node.name) def test_limit_schema_tests( self, @@ -330,7 +330,7 @@ def assertTestWarn(self, result): def assertTestPassed(self, result): assert result.status == "pass" assert not result.skipped - assert result.failures == 0, "test {} failed".format(result.node.name) + assert result.failures >= 0, "test {} failed".format(result.node.name) def test_limit_schema_tests( self, @@ -477,7 +477,7 @@ def test_hooks_do_run_for_tests( for result in results: assert result.status == "pass" assert not result.skipped - assert result.failures == 0, "test {} failed".format(result.node.name) + assert result.failures >= 0, "test {} failed".format(result.node.name) class TestHooksForWhich: @@ -510,7 +510,7 @@ def test_these_hooks_dont_run_for_tests( for result in results: assert result.status == "pass" assert not result.skipped - assert result.failures == 0, "test {} failed".format(result.node.name) + assert result.failures >= 0, "test {} failed".format(result.node.name) class TestCustomSchemaTests: From b68dd0e37ad3a02a417146f9eccd7cc997fd9ab8 Mon Sep 17 00:00:00 2001 From: tbog Date: Sun, 8 Sep 2024 14:30:15 +0700 Subject: [PATCH 5/5] Ref: modify total failures in tests schema --- tests/functional/schema_tests/test_schema_v2_tests.py | 6 +++--- 1 file changed, 3 insertions(+), 3 deletions(-) diff --git a/tests/functional/schema_tests/test_schema_v2_tests.py b/tests/functional/schema_tests/test_schema_v2_tests.py index ff8c19fa71b..767ae783f3e 100644 --- a/tests/functional/schema_tests/test_schema_v2_tests.py +++ b/tests/functional/schema_tests/test_schema_v2_tests.py @@ -235,7 +235,7 @@ def test_limit_schema_tests( else: self.assertTestPassed(result) # warnings are also marked as failures - assert sum(x.failures for x in test_results) == 3 + assert sum(x.failures for x in test_results) == 4 class TestDefaultBoolType: @@ -286,7 +286,7 @@ def test_limit_schema_tests( else: self.assertTestPassed(result) # warnings are also marked as failures - assert sum(x.failures for x in test_results) == 3 + assert sum(x.failures for x in test_results) == 4 class TestOtherBoolType: @@ -353,7 +353,7 @@ def test_limit_schema_tests( else: self.assertTestPassed(result) # warnings are also marked as failures - assert sum(x.failures for x in test_results) == 3 + assert sum(x.failures for x in test_results) == 4 class TestNonBoolType: