Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Rename tests: to data_tests: for v1 #514

Merged
merged 2 commits into from
Dec 5, 2024
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
2 changes: 1 addition & 1 deletion docs/ci-check.md
Original file line number Diff line number Diff line change
Expand Up @@ -14,7 +14,7 @@ By default the tests in this package are configured with "warn" severity, we can
1. Update you project.yml file to override the default severity for all tests in this package:

```yaml title="dbt_project.yml"
tests:
data_tests:
dbt_project_evaluator:
+severity: "{{ env_var('DBT_PROJECT_EVALUATOR_SEVERITY', 'warn') }}"
```
Expand Down
2 changes: 1 addition & 1 deletion docs/customization/customization.md
Original file line number Diff line number Diff line change
Expand Up @@ -14,7 +14,7 @@ disable the corresponding `fct` models as you would any other model in your `dbt
models:
dbt_project_evaluator:
marts:
tests:
data_tests:
# disable entire test coverage suite
+enabled: false
dag:
Expand Down
2 changes: 1 addition & 1 deletion docs/customization/issues-in-log.md
Original file line number Diff line number Diff line change
Expand Up @@ -22,6 +22,6 @@ the custom models.
models:
- name: my_custom_rule_model
description: This is my custom project evaluator check
tests:
data_tests:
- dbt_project_evaluator.is_empty
```
2 changes: 1 addition & 1 deletion integration_tests/dbt_project.yml
Original file line number Diff line number Diff line change
Expand Up @@ -34,7 +34,7 @@ models:
+materialized: ephemeral
dbt_project_evaluator:
marts:
tests:
data_tests:
fct_test_coverage:
# materialize as a table to ensure SQL query runs successfully
+materialized: table
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -6,25 +6,25 @@ models:
columns:
- name: path
description: unique identifier representing a distinct path from each resource to another resource
tests:
data_tests:
- unique
- not_null

- name: int_all_graph_resources
description: "This table shows one record for each enabled resource in the graph and information about that resource."
columns:
- name: resource_id
tests:
data_tests:
- unique
- not_null
- name: on_schema_change
description: this contains the on_schema_change setting for incremental models. This column was sometimes an empty string, so should be tested to detect regressions
tests:
data_tests:
- not_null:
config:
where: resource_type = 'model'
- name: model_type
tests:
data_tests:
- dbt_utils.expression_is_true:
expression: "= 'base'"
config:
Expand All @@ -34,6 +34,6 @@ models:
description: "This table shows one record for each direct parent/child pair in the graph."
columns:
- name: unique_id
tests:
data_tests:
- unique
- not_null
Original file line number Diff line number Diff line change
Expand Up @@ -5,53 +5,53 @@ models:
description: "Staging model from the graph variable, one record per exposure resource relationship (comes from the depends_on field in the graph)."
columns:
- name: unique_id
tests:
data_tests:
- unique
- not_null

- name: stg_exposures
description: "Staging model from the graph variable, one record per exposure resource."
columns:
- name: unique_id
tests:
data_tests:
- unique
- not_null

- name: stg_metric_relationships
description: "Staging model from the graph variable, one record per metric resource relationship (comes from the depends_on field in the graph)."
columns:
- name: unique_id
tests:
data_tests:
- unique
- not_null

- name: stg_metrics
description: "Staging model from the graph variable, one record per metric resource."
columns:
- name: unique_id
tests:
data_tests:
- unique
- not_null

- name: stg_node_relationships
description: "Staging model from the graph variable, one record per direct node relationship (comes from the depends_on field in the graph)."
columns:
- name: unique_id
tests:
data_tests:
- unique
- not_null

- name: stg_nodes
description: "Staging model from the graph variable, one record per node (analysis, model, operation, seed, snapshot, test)."
columns:
- name: unique_id
tests:
data_tests:
- unique
- not_null

- name: stg_columns
description: "Staging model from the graph variable, one record per column resource."
tests:
data_tests:
- dbt_utils.unique_combination_of_columns:
combination_of_columns:
- node_unique_id
Expand All @@ -61,19 +61,19 @@ models:
description: "Staging model from the graph variable, one record per source resource."
columns:
- name: unique_id
tests:
data_tests:
- unique
- not_null

- name: stg_naming_convention_folders
description: "This table parses the folder name variables into a model to help define structure tests"
columns:
- name: folder_name
tests:
data_tests:
- unique
- not_null
- name: model_type
tests:
data_tests:
- accepted_values:
values: "{{ var('model_types') }}"

Expand All @@ -82,10 +82,10 @@ models:
columns:
- name: unique_id
description: surrogate key of model_type and prefix value
tests:
data_tests:
- unique
- not_null
- name: model_type
tests:
data_tests:
- accepted_values:
values: "{{ var('model_types') }}"
Original file line number Diff line number Diff line change
Expand Up @@ -5,6 +5,6 @@ models:
description: this model creates some initial metrics required for the downstream models related to testing
columns:
- name: resource_name
tests:
data_tests:
- unique
- not_null
Original file line number Diff line number Diff line change
Expand Up @@ -8,5 +8,5 @@ models:
data_type: "{{ 'UInt8' if target.type in ['clickhouse'] else 'int' }}"
constraints:
- type: not_null
tests:
data_tests:
- unique
6 changes: 3 additions & 3 deletions integration_tests/models/staging/source_1/schema.yml
Original file line number Diff line number Diff line change
Expand Up @@ -8,17 +8,17 @@ models:
description: >
hocus pocus
pocus hocus
tests:
data_tests:
- unique
- name: stg_model_3
tests:
data_tests:
- dbt_utils.unique_combination_of_columns:
combination_of_columns:
- id
- color
- name: stg_model_2
columns:
- name: id
tests:
data_tests:
- unique
- not_null
6 changes: 3 additions & 3 deletions integration_tests/models/staging/staging.yml
Original file line number Diff line number Diff line change
Expand Up @@ -4,19 +4,19 @@ models:
- name: stg_model_4
columns:
- name: id
tests:
data_tests:
- unique
- not_null
- relationships:
to: ref('stg_model_2')
field: id
- name: "concat(coalesce('fake_column', ' '),'for_testing')"
tests:
data_tests:
- not_null

- name: int_model_4
columns:
- name: id
tests:
data_tests:
- unique
- not_null
2 changes: 1 addition & 1 deletion integration_tests/models/utils/_utils_models.yml
Original file line number Diff line number Diff line change
Expand Up @@ -3,6 +3,6 @@ models:
description: default time spine for metricflow
columns:
- name: date_day
tests:
data_tests:
- unique
- not_null
22 changes: 11 additions & 11 deletions integration_tests/seeds/dag/dag_seeds.yml
Original file line number Diff line number Diff line change
Expand Up @@ -2,7 +2,7 @@ version: 2

seeds:
- name: test_fct_multiple_sources_joined
tests:
data_tests:
- dbt_utils.equality:
name: equality_fct_multiple_sources_joined
compare_model: ref('fct_multiple_sources_joined')
Expand All @@ -11,7 +11,7 @@ seeds:
- "{{ 'source_parents' if target.type != 'databricks' else 'child' }}"

- name: test_fct_direct_join_to_source
tests:
data_tests:
- dbt_utils.equality:
name: equality_fct_direct_join_to_source
compare_model: ref('fct_direct_join_to_source')
Expand All @@ -23,27 +23,27 @@ seeds:
- distance

- name: test_fct_duplicate_sources
tests:
data_tests:
- dbt_utils.equality:
name: equality_fct_duplicate_sources
compare_model: ref('fct_duplicate_sources')
compare_columns:
- source_names

- name: test_fct_root_models
tests:
data_tests:
- dbt_utils.equality:
name: equality_fct_root_models
compare_model: ref('fct_root_models')

- name: test_fct_unused_sources
tests:
data_tests:
- dbt_utils.equality:
name: equality_fct_unused_sources
compare_model: ref('fct_unused_sources')

- name: test_fct_source_fanout
tests:
data_tests:
- dbt_utils.equality:
name: equality_fct_source_fanout
compare_model: ref('fct_source_fanout')
Expand All @@ -52,7 +52,7 @@ seeds:
- "{{ 'model_children' if target.type != 'databricks' else 'parent' }}"

- name: test_fct_model_fanout
tests:
data_tests:
- dbt_utils.equality:
name: equality_fct_model_fanout
compare_model: ref('fct_model_fanout')
Expand All @@ -62,7 +62,7 @@ seeds:
- "{{ 'leaf_children' if target.type != 'databricks' else 'parent_model_type' }}"

- name: test_fct_staging_dependent_on_staging
tests:
data_tests:
- dbt_utils.equality:
name: equality_fct_staging_dependent_on_staging
compare_model: ref('fct_staging_dependent_on_staging')
Expand All @@ -73,7 +73,7 @@ seeds:
- child_model_type

- name: test_fct_rejoining_of_upstream_concepts
tests:
data_tests:
- dbt_utils.equality:
name: equality_fct_rejoining_of_upstream_concepts
compare_model: ref('fct_rejoining_of_upstream_concepts')
Expand All @@ -84,7 +84,7 @@ seeds:
- is_loop_independent

- name: test_fct_hard_coded_references
tests:
data_tests:
- dbt_utils.equality:
name: equality_fct_hard_coded_references
compare_model: ref('fct_hard_coded_references')
Expand All @@ -93,7 +93,7 @@ seeds:
- hard_coded_references

- name: test_fct_too_many_joins
tests:
data_tests:
- dbt_utils.equality:
name: equality_fct_too_many_joins
compare_model: ref('fct_too_many_joins')
Expand Down
8 changes: 4 additions & 4 deletions integration_tests/seeds/docs/docs_seeds.yml
Original file line number Diff line number Diff line change
Expand Up @@ -5,7 +5,7 @@ seeds:
config:
tags:
- docs
tests:
data_tests:
- dbt_utils.equality:
name: equality_fct_undocumented_models
compare_model: ref('fct_undocumented_models')
Expand All @@ -19,7 +19,7 @@ seeds:
other_documentation_coverage_pct: *float
tags:
- docs
tests:
data_tests:
- dbt_utils.equality:
name: equality_fct_documentation_coverage
compare_model: ref('fct_documentation_coverage')
Expand All @@ -36,7 +36,7 @@ seeds:
config:
tags:
- docs
tests:
data_tests:
- dbt_utils.equality:
name: equality_fct_undocumented_source_tables
compare_model: ref('fct_undocumented_source_tables')
Expand All @@ -45,7 +45,7 @@ seeds:
config:
tags:
- docs
tests:
data_tests:
- dbt_utils.equality:
name: equality_fct_undocumented_sources
compare_model: ref('fct_undocumented_sources')
6 changes: 3 additions & 3 deletions integration_tests/seeds/governance/_governance_seeds.yml
Original file line number Diff line number Diff line change
Expand Up @@ -2,16 +2,16 @@ version: 2

seeds:
- name: test_fct_public_models_without_contract
tests:
data_tests:
- dbt_utils.equality:
compare_model: ref('fct_public_models_without_contract')

- name: test_fct_undocumented_public_models
tests:
data_tests:
- dbt_utils.equality:
compare_model: ref('fct_undocumented_public_models')

- name: test_fct_exposures_dependent_on_private_models
tests:
data_tests:
- dbt_utils.equality:
compare_model: ref('fct_exposures_dependent_on_private_models')
Loading
Loading