-
Notifications
You must be signed in to change notification settings - Fork 1.6k
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
Fix for dbt_project.yml "tests" config resulting in incorrect state:m…
…odified (#11166)
- Loading branch information
Showing
3 changed files
with
54 additions
and
0 deletions.
There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,6 @@ | ||
kind: Fixes | ||
body: Fix unrendered_config for tests from dbt_project.yml | ||
time: 2024-12-18T11:26:40.270022-05:00 | ||
custom: | ||
Author: gshank | ||
Issue: "11146" |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,45 @@ | ||
import pytest | ||
|
||
from dbt.tests.util import run_dbt | ||
|
||
dbt_project_update = """ | ||
models: | ||
my_dbt_project: | ||
+materialized: table | ||
tests: | ||
+store_failures: true | ||
""" | ||
|
||
foo_sql = """ | ||
select 1 as id | ||
""" | ||
|
||
schema_yml = """ | ||
models: | ||
- name: foo | ||
columns: | ||
- name: id | ||
tests: | ||
- unique | ||
""" | ||
|
||
|
||
class TestGenericTestUnrenderedConfig: | ||
@pytest.fixture(scope="class") | ||
def project_config_update(self): | ||
return dbt_project_update | ||
|
||
@pytest.fixture(scope="class") | ||
def models(self): | ||
return { | ||
"foo.sql": foo_sql, | ||
"schema.yml": schema_yml, | ||
} | ||
|
||
def test_unrendered_config(self, project): | ||
manifest = run_dbt(["parse"]) | ||
assert manifest | ||
test_node_id = "test.test.unique_foo_id.fa8c520a2e" | ||
test_node = manifest.nodes[test_node_id] | ||
assert test_node.unrendered_config == {"store_failures": True} |