From 845d4cb7f728cc01e397fe429abe62449cf95d72 Mon Sep 17 00:00:00 2001 From: Ryan Hill Date: Tue, 7 Feb 2023 13:17:20 +0000 Subject: [PATCH] CI fix 2.0 --- ...ts.csv => data_test_equality_floats_a.csv} | 0 .../data_test_equality_floats_b.csv | 11 +++ ...> data_test_equality_floats_columns_a.csv} | 0 .../data_test_equality_floats_columns_b.csv | 11 +++ integration_tests/dbt_project.yml | 13 +++- .../models/generic_tests/schema.yml | 67 +++++++++---------- .../generic_tests/test_equality_floats.sql | 9 --- .../test_equality_floats_columns.sql | 9 --- 8 files changed, 65 insertions(+), 55 deletions(-) rename integration_tests/data/schema_tests/{data_test_equality_floats.csv => data_test_equality_floats_a.csv} (100%) create mode 100644 integration_tests/data/schema_tests/data_test_equality_floats_b.csv rename integration_tests/data/schema_tests/{data_test_equality_floats_columns.csv => data_test_equality_floats_columns_a.csv} (100%) create mode 100644 integration_tests/data/schema_tests/data_test_equality_floats_columns_b.csv delete mode 100644 integration_tests/models/generic_tests/test_equality_floats.sql delete mode 100644 integration_tests/models/generic_tests/test_equality_floats_columns.sql diff --git a/integration_tests/data/schema_tests/data_test_equality_floats.csv b/integration_tests/data/schema_tests/data_test_equality_floats_a.csv similarity index 100% rename from integration_tests/data/schema_tests/data_test_equality_floats.csv rename to integration_tests/data/schema_tests/data_test_equality_floats_a.csv diff --git a/integration_tests/data/schema_tests/data_test_equality_floats_b.csv b/integration_tests/data/schema_tests/data_test_equality_floats_b.csv new file mode 100644 index 00000000..0306a9aa --- /dev/null +++ b/integration_tests/data/schema_tests/data_test_equality_floats_b.csv @@ -0,0 +1,11 @@ +id,float_number +05ac09c4-f947-45a8-8c14-88f430f8b294,62.3888187 +cfae9054-940b-42a1-84d4-052daae6194f,81.2511657 +6029501d-c274-49f2-a69d-4c75a3d9931d,23.3959676 +c653e520-df81-4a5f-b44b-bb1b4c1b7846,72.2100842 +59caed0d-53d6-473c-a88c-3726c7693f05,68.6029435 +b441f6a0-ce7f-4ad9-b96b-b41d73a94ae7,72.7861426 +26491840-bfd4-4496-9ca9-ad9220a2de47,35.3662224 +b4f233ce-a494-4bb6-9cf2-73bb6854e58a,89.1524681 +11c979b7-2661-4375-8143-7c9b54b90627,19.5755432 +a8057f73-312e-48e6-b344-f4a510a2c4a8,22.9237048 diff --git a/integration_tests/data/schema_tests/data_test_equality_floats_columns.csv b/integration_tests/data/schema_tests/data_test_equality_floats_columns_a.csv similarity index 100% rename from integration_tests/data/schema_tests/data_test_equality_floats_columns.csv rename to integration_tests/data/schema_tests/data_test_equality_floats_columns_a.csv diff --git a/integration_tests/data/schema_tests/data_test_equality_floats_columns_b.csv b/integration_tests/data/schema_tests/data_test_equality_floats_columns_b.csv new file mode 100644 index 00000000..e26305de --- /dev/null +++ b/integration_tests/data/schema_tests/data_test_equality_floats_columns_b.csv @@ -0,0 +1,11 @@ +id,float_number,to_ignore +05ac09c4-f947-45a8-8c14-88f430f8b294,62.3888186,b +cfae9054-940b-42a1-84d4-052daae6194f,81.2511656,b +6029501d-c274-49f2-a69d-4c75a3d9931d,23.3959675,b +c653e520-df81-4a5f-b44b-bb1b4c1b7846,72.2100841,b +59caed0d-53d6-473c-a88c-3726c7693f05,68.6029434,b +b441f6a0-ce7f-4ad9-b96b-b41d73a94ae7,72.7861425,b +26491840-bfd4-4496-9ca9-ad9220a2de47,35.3662223,b +b4f233ce-a494-4bb6-9cf2-73bb6854e58a,89.1524680,b +11c979b7-2661-4375-8143-7c9b54b90627,19.5755431,b +a8057f73-312e-48e6-b344-f4a510a2c4a8,22.9237047,b diff --git a/integration_tests/dbt_project.yml b/integration_tests/dbt_project.yml index f50651b2..0c7936ee 100644 --- a/integration_tests/dbt_project.yml +++ b/integration_tests/dbt_project.yml @@ -72,11 +72,18 @@ seeds: +column_types: my_timestamp: timestamp - data_test_equality_floats: + data_test_equality_floats_a: +column_types: float_number: float - data_test_equality_floats_columns: + data_test_equality_floats_columns_a: + +column_types: + float_number: float + + data_test_equality_floats_b: + +column_types: + float_number: float + + data_test_equality_floats_columns_b: +column_types: float_number: float - to_ignore: varchar(1) diff --git a/integration_tests/models/generic_tests/schema.yml b/integration_tests/models/generic_tests/schema.yml index d96cc6c3..461f391e 100644 --- a/integration_tests/models/generic_tests/schema.yml +++ b/integration_tests/models/generic_tests/schema.yml @@ -160,6 +160,39 @@ seeds: ignore_columns: - col_c + - name: data_test_equality_floats_a + tests: + # test precision only + - dbt_utils.equality: + compare_model: ref('data_test_equality_floats_b') + precision: 4 + - dbt_utils.equality: + compare_model: ref('data_test_equality_floats_b') + precision: 8 + error_if: "<1" #sneaky way to ensure that the test is returning failing rows + warn_if: "<0" + + - name: data_test_equality_floats_columns_a + tests: + # Positive assertion tests + - dbt_utils.equality: + compare_model: ref('data_test_equality_floats_columns_b') + compare_columns: + - id + - float_number + precision: 4 + - dbt_utils.equality: + compare_model: ref('data_test_equality_floats_columns_b') + ignore_columns: + - to_ignore + precision: 4 + # all columns should fail even with rounding + - dbt_utils.equality: + compare_model: ref('data_test_equality_floats_columns_b') + precision: 4 + error_if: "<1" #sneaky way to ensure that the test is returning failing rows + warn_if: "<0" + models: - name: recency_time_included tests: @@ -210,40 +243,6 @@ models: - last_name - email - - name: test_equality_floats - tests: - # test precision only - - dbt_utils.equality: - compare_model: ref('data_test_equality_floats') - precision: 4 - - dbt_utils.equality: - compare_model: ref('data_test_equality_floats') - precision: 8 - error_if: "<1" #sneaky way to ensure that the test is returning failing rows - warn_if: "<0" - - - name: test_equality_floats_columns - tests: - # Positive assertion tests - - dbt_utils.equality: - compare_model: ref('data_test_equality_floats_columns') - compare_columns: - - id - - float_number - precision: 4 - - dbt_utils.equality: - compare_model: ref('data_test_equality_floats_columns') - ignore_columns: - - to_ignore - precision: 4 - # all columns should fail even with rounding - - dbt_utils.equality: - compare_model: ref('data_test_equality_floats_columns') - precision: 4 - error_if: "<1" #sneaky way to ensure that the test is returning failing rows - warn_if: "<0" - - - name: test_fewer_rows_than tests: - dbt_utils.fewer_rows_than: diff --git a/integration_tests/models/generic_tests/test_equality_floats.sql b/integration_tests/models/generic_tests/test_equality_floats.sql deleted file mode 100644 index 9c84bb5c..00000000 --- a/integration_tests/models/generic_tests/test_equality_floats.sql +++ /dev/null @@ -1,9 +0,0 @@ -with data as ( - - select * from {{ ref('data_test_equality_floats') }} - -) - -select - id, float_number + 0.0000001 as float_number -from data diff --git a/integration_tests/models/generic_tests/test_equality_floats_columns.sql b/integration_tests/models/generic_tests/test_equality_floats_columns.sql deleted file mode 100644 index b8087567..00000000 --- a/integration_tests/models/generic_tests/test_equality_floats_columns.sql +++ /dev/null @@ -1,9 +0,0 @@ -with data as ( - - select * from {{ ref('data_test_equality_floats') }} - -) - -select - id, float_number + 0.0000001 as float_number, cast('b' as varchar(1)) as to_ignore -from data