From 69330a1790ce9eec027956c2e34c5df5ccd2b4ba Mon Sep 17 00:00:00 2001 From: Pedro Sousa Date: Thu, 6 Jul 2023 17:12:57 +0100 Subject: [PATCH] Add test for unit-test tags issue --- integration-tests/macros/macro_with_ref.sql | 3 +++ macros/tests.sql | 2 +- run-integration-tests.sh | 2 ++ 3 files changed, 6 insertions(+), 1 deletion(-) create mode 100644 integration-tests/macros/macro_with_ref.sql diff --git a/integration-tests/macros/macro_with_ref.sql b/integration-tests/macros/macro_with_ref.sql new file mode 100644 index 0000000..af0a716 --- /dev/null +++ b/integration-tests/macros/macro_with_ref.sql @@ -0,0 +1,3 @@ +{% macro macro_with_ref() %} + {% set dummy = dbt_unit_testing.ref('model_a') %} +{% endmacro %} diff --git a/macros/tests.sql b/macros/tests.sql index 1bb6752..7d24114 100644 --- a/macros/tests.sql +++ b/macros/tests.sql @@ -177,7 +177,7 @@ {% endmacro %} {% macro running_unit_test() %} - {{ return (config.get('tags') and 'unit-test' in config.get('tags')) }} + {{ return ('unit-test' in config.get('tags', {})) }} {% endmacro %} {% macro ref_tested_model(model_name) %} diff --git a/run-integration-tests.sh b/run-integration-tests.sh index 4d10f42..8a3ab22 100755 --- a/run-integration-tests.sh +++ b/run-integration-tests.sh @@ -16,6 +16,8 @@ if [[ ! -e ~/.dbt/profiles.yml ]]; then cp ci/profiles.yml ~/.dbt/profiles.yml fi +dbt run-operation macro_with_ref --target "$PROFILE" + dbt deps --target "$PROFILE" # create seeds in the database