[Core] Assert an expected failure by overriding error_if
#5719
Labels
content
Improvements or additions to content
dbt Core
The changes proposed in this issue relate to dbt Core
size: medium
This change will take up to a week to address
Link to the page(s) on docs.getdbt.com requiring updates
We have docs for configuring
severity
for data tests:https://docs.getdbt.com/reference/resource-configs/severity
We just want to add an example for using
error_if
to assert the expectation that a test will fail. This is helpful in integration testing for dbt packages like dbt_utils.Tell us more about this update
Question:
Answer:
Reviewers/Stakeholders/SMEs
Dee bEighty Ten
Related GitHub issues
No response
Additional information
By default for dbt data tests:
!=0
rows willFAIL
(explicitly)0
row willPASS
(implicitly)Overriding the config to
error_if: "<1"
will invert the default logic so that:0
row willFAIL
(explicitly)!=0
rows willPASS
(implicitly)This also requires adding
warn_if: "<0"
to work properly. Otherwise, the default warning condition will still take effect. Overridingwarn_if
in this way takes it out of play since there should never be less than 0 rows returned.The text was updated successfully, but these errors were encountered: