-
Notifications
You must be signed in to change notification settings - Fork 4
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
Merge pull request #2 from kgmcquate/develop
Added multiple test generation, more tests, and many bugfixes
- Loading branch information
Showing
20 changed files
with
523 additions
and
102 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
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 |
---|---|---|
|
@@ -17,4 +17,4 @@ clean-targets: | |
|
||
seeds: | ||
+schema: integration_test_data | ||
+quote_columns: false | ||
+quote_columns: true |
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 |
---|---|---|
@@ -1 +1,4 @@ | ||
docker run -it -v ${PWD}:/run/dbt-testgen dbt-testgen-integration-test bash | ||
docker run -it -v ${PWD}:/run/dbt-testgen dbt-testgen-integration-test bash | ||
|
||
|
||
docker run -it -v ${PWD}:/run/dbt-testgen python:3.11 bash |
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,4 @@ | ||
First Name,Age (Years),Current City | ||
John,25,New York | ||
Alice,30,San Francisco | ||
Bob,22,Chicago |
40 changes: 40 additions & 0 deletions
40
...ation_tests/tests/generate_accepted_values_tests/accepted_values_colnames_with_spaces.sql
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,40 @@ | ||
|
||
|
||
{% set actual_yaml = toyaml(fromjson(tojson( | ||
testgen.get_accepted_values_test_suggestions( | ||
ref('colnames_with_spaces') | ||
) | ||
))) | ||
%} | ||
|
||
{% set expected_yaml %} | ||
models: | ||
- name: colnames_with_spaces | ||
columns: | ||
- name: First Name | ||
description: Accepted values test generated by dbt-testgen | ||
tests: | ||
- accepted_values: | ||
values: | ||
- Alice | ||
- Bob | ||
- John | ||
- name: Age (Years) | ||
description: Accepted values test generated by dbt-testgen | ||
tests: | ||
- accepted_values: | ||
values: | ||
- '22' | ||
- '25' | ||
- '30' | ||
- name: Current City | ||
description: Accepted values test generated by dbt-testgen | ||
tests: | ||
- accepted_values: | ||
values: | ||
- Chicago | ||
- New York | ||
- San Francisco | ||
{% endset %} | ||
|
||
{{ assert_equal (actual_yaml | trim, expected_yaml | trim) }} |
File renamed without changes.
22 changes: 22 additions & 0 deletions
22
integration_tests/tests/generate_range_tests/range_colnames_with_spaces.sql
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,22 @@ | ||
|
||
|
||
{% set actual_yaml = toyaml(fromjson(tojson( | ||
testgen.get_range_test_suggestions( | ||
ref('colnames_with_spaces') | ||
) | ||
))) | ||
%} | ||
|
||
{% set expected_yaml %} | ||
models: | ||
- name: colnames_with_spaces | ||
columns: | ||
- name: Age (Years) | ||
description: Numeric range test generated by dbt-testgen | ||
tests: | ||
- dbt_utils.accepted_range: | ||
min_value: 22 | ||
max_value: 30 | ||
{% endset %} | ||
|
||
{{ assert_equal (actual_yaml | trim, expected_yaml | trim) }} |
File renamed without changes.
32 changes: 32 additions & 0 deletions
32
integration_tests/tests/generate_uniqueness_tests/uniqueness_users.sql
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,32 @@ | ||
|
||
|
||
{% set actual_yaml = toyaml(fromjson(tojson( | ||
testgen.get_uniqueness_test_suggestions( | ||
ref('users'), | ||
compound_key_length = 1 | ||
) | ||
))) | ||
%} | ||
|
||
{% set expected_yaml %} | ||
models: | ||
- name: users | ||
columns: | ||
- name: user_id | ||
description: Uniqueness test generated by dbt-testgen | ||
tests: | ||
- unique | ||
- not_null | ||
- name: username | ||
description: Uniqueness test generated by dbt-testgen | ||
tests: | ||
- unique | ||
- not_null | ||
- name: email | ||
description: Uniqueness test generated by dbt-testgen | ||
tests: | ||
- unique | ||
- not_null | ||
{% endset %} | ||
|
||
{{ assert_equal (actual_yaml | trim, expected_yaml | trim) }} |
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
58 changes: 58 additions & 0 deletions
58
integration_tests/tests/merge_dbt_configs/merge_dbt_configs_2.sql
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,58 @@ | ||
{% set input_yaml_1 %} | ||
models: | ||
- name: users | ||
tests: [] | ||
columns: | ||
- name: user_id | ||
description: Uniqueness test generated by dbt-testgen | ||
tests: | ||
- unique: | ||
tags: | ||
- uniqueness | ||
- not_null: | ||
tags: | ||
- uniqueness | ||
{% endset %} | ||
|
||
{% set input_yaml_2 %} | ||
models: | ||
- name: users | ||
tests: [] | ||
columns: | ||
- name: user_id | ||
description: Uniqueness test generated by dbt-testgen | ||
tests: | ||
- accepted_values: | ||
values: | ||
- active | ||
- inactive | ||
{% endset %} | ||
|
||
{% set actual_yaml = toyaml( | ||
testgen.merge_dbt_configs( | ||
fromyaml(input_yaml_1), | ||
fromyaml(input_yaml_2) | ||
) | ||
) | ||
%} | ||
|
||
|
||
{% set expected_yaml %} | ||
models: | ||
- name: users | ||
columns: | ||
- name: user_id | ||
tests: | ||
- unique: | ||
tags: | ||
- uniqueness | ||
- not_null: | ||
tags: | ||
- uniqueness | ||
- accepted_values: | ||
values: | ||
- active | ||
- inactive | ||
{% endset %} | ||
|
||
{{ assert_equal (actual_yaml | trim, expected_yaml | trim) }} |
42 changes: 42 additions & 0 deletions
42
integration_tests/tests/test_test_selection/test_selection_users.sql
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,42 @@ | ||
|
||
|
||
{% set actual_yaml = toyaml(fromjson(tojson( | ||
testgen.get_test_suggestions( | ||
ref('users') | ||
) | ||
))) | ||
%} | ||
|
||
{% set expected_yaml %} | ||
models: | ||
- name: users | ||
columns: | ||
- name: user_id | ||
tests: | ||
- unique | ||
- not_null | ||
- dbt_utils.accepted_range: | ||
min_value: 1 | ||
max_value: 30 | ||
- name: username | ||
tests: | ||
- unique | ||
- not_null | ||
- name: email | ||
tests: | ||
- unique | ||
- not_null | ||
- name: user_status | ||
tests: | ||
- accepted_values: | ||
values: | ||
- active | ||
- inactive | ||
- name: age | ||
tests: | ||
- dbt_utils.accepted_range: | ||
min_value: 22 | ||
max_value: 35 | ||
{% endset %} | ||
|
||
{{ assert_equal (actual_yaml | trim, expected_yaml | trim) }} |
Oops, something went wrong.