-
Notifications
You must be signed in to change notification settings - Fork 1.7k
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
ADAP-850: Support test results as a view (#8653)
* add `store_failures_as` parameter to TestConfig, catch strategy parameter in test materialization * create test results as views * updated test expected values for new config option * break up tests into reusable tests and adapter specific configuration, update test to check for relation type and confirm views update * move test configuration into base test class * allow `store_failures_as` to drive whether failures are stored * update expected test config dicts to include the new default value for store_failures_as * Add `store_failures_as` config for generic tests * cover --store-failures on CLI gap * add generic tests test case for store_failures_as * update object names for generic test case tests for store_failures_as * remove unique generic test, it was not testing `store_failures_as` * pull generic run and assertion into base test class to turn tests into quasi-parameterized tests * add ephemeral option for store_failures_as, as a way to easily turn off store_failures at the model level * add compilation error for invalid setting of store_failures_as --------- Co-authored-by: Doug Beatty <doug.beatty@dbtlabs.com>
- Loading branch information
1 parent
4f9bd0c
commit 3d27483
Showing
11 changed files
with
590 additions
and
4 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: Features | ||
body: Support storing test failures as views | ||
time: 2023-09-15T17:44:28.833877-04:00 | ||
custom: | ||
Author: mikealfare | ||
Issue: "6914" |
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
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
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
150 changes: 150 additions & 0 deletions
150
tests/adapter/dbt/tests/adapter/store_test_failures_tests/_files.py
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,150 @@ | ||
SEED__CHIPMUNKS = """ | ||
name,shirt | ||
alvin,red | ||
simon,blue | ||
theodore,green | ||
dave, | ||
""".strip() | ||
|
||
|
||
MODEL__CHIPMUNKS = """ | ||
{{ config(materialized='table') }} | ||
select * | ||
from {{ ref('chipmunks_stage') }} | ||
""" | ||
|
||
|
||
TEST__VIEW_TRUE = """ | ||
{{ config(store_failures_as="view", store_failures=True) }} | ||
select * | ||
from {{ ref('chipmunks') }} | ||
where shirt = 'green' | ||
""" | ||
|
||
|
||
TEST__VIEW_FALSE = """ | ||
{{ config(store_failures_as="view", store_failures=False) }} | ||
select * | ||
from {{ ref('chipmunks') }} | ||
where shirt = 'green' | ||
""" | ||
|
||
|
||
TEST__VIEW_UNSET = """ | ||
{{ config(store_failures_as="view") }} | ||
select * | ||
from {{ ref('chipmunks') }} | ||
where shirt = 'green' | ||
""" | ||
|
||
|
||
TEST__TABLE_TRUE = """ | ||
{{ config(store_failures_as="table", store_failures=True) }} | ||
select * | ||
from {{ ref('chipmunks') }} | ||
where shirt = 'green' | ||
""" | ||
|
||
|
||
TEST__TABLE_FALSE = """ | ||
{{ config(store_failures_as="table", store_failures=False) }} | ||
select * | ||
from {{ ref('chipmunks') }} | ||
where shirt = 'green' | ||
""" | ||
|
||
|
||
TEST__TABLE_UNSET = """ | ||
{{ config(store_failures_as="table") }} | ||
select * | ||
from {{ ref('chipmunks') }} | ||
where shirt = 'green' | ||
""" | ||
|
||
|
||
TEST__EPHEMERAL_TRUE = """ | ||
{{ config(store_failures_as="ephemeral", store_failures=True) }} | ||
select * | ||
from {{ ref('chipmunks') }} | ||
where shirt = 'green' | ||
""" | ||
|
||
|
||
TEST__EPHEMERAL_FALSE = """ | ||
{{ config(store_failures_as="ephemeral", store_failures=False) }} | ||
select * | ||
from {{ ref('chipmunks') }} | ||
where shirt = 'green' | ||
""" | ||
|
||
|
||
TEST__EPHEMERAL_UNSET = """ | ||
{{ config(store_failures_as="ephemeral") }} | ||
select * | ||
from {{ ref('chipmunks') }} | ||
where shirt = 'green' | ||
""" | ||
|
||
|
||
TEST__UNSET_TRUE = """ | ||
{{ config(store_failures=True) }} | ||
select * | ||
from {{ ref('chipmunks') }} | ||
where shirt = 'green' | ||
""" | ||
|
||
|
||
TEST__UNSET_FALSE = """ | ||
{{ config(store_failures=False) }} | ||
select * | ||
from {{ ref('chipmunks') }} | ||
where shirt = 'green' | ||
""" | ||
|
||
|
||
TEST__UNSET_UNSET = """ | ||
select * | ||
from {{ ref('chipmunks') }} | ||
where shirt = 'green' | ||
""" | ||
|
||
|
||
TEST__VIEW_UNSET_PASS = """ | ||
{{ config(store_failures_as="view") }} | ||
select * | ||
from {{ ref('chipmunks') }} | ||
where shirt = 'purple' | ||
""" | ||
|
||
|
||
TEST__ERROR_UNSET = """ | ||
{{ config(store_failures_as="error") }} | ||
select * | ||
from {{ ref('chipmunks') }} | ||
where shirt = 'green' | ||
""" | ||
|
||
|
||
SCHEMA_YML = """ | ||
version: 2 | ||
models: | ||
- name: chipmunks | ||
columns: | ||
- name: name | ||
tests: | ||
- not_null: | ||
store_failures_as: view | ||
- accepted_values: | ||
store_failures: false | ||
store_failures_as: table | ||
values: | ||
- alvin | ||
- simon | ||
- theodore | ||
- name: shirt | ||
tests: | ||
- not_null: | ||
store_failures: true | ||
store_failures_as: view | ||
""" |
Oops, something went wrong.