diff --git a/tests/integration/defer_state_test/macros/infinite_macros.sql b/tests/integration/defer_state_test/macros/infinite_macros.sql deleted file mode 100644 index 81d2083d3..000000000 --- a/tests/integration/defer_state_test/macros/infinite_macros.sql +++ /dev/null @@ -1,13 +0,0 @@ -{# trigger infinite recursion if not handled #} - -{% macro my_infinitely_recursive_macro() %} - {{ return(adapter.dispatch('my_infinitely_recursive_macro')()) }} -{% endmacro %} - -{% macro default__my_infinitely_recursive_macro() %} - {% if unmet_condition %} - {{ my_infinitely_recursive_macro() }} - {% else %} - {{ return('') }} - {% endif %} -{% endmacro %} diff --git a/tests/integration/defer_state_test/macros/macros.sql b/tests/integration/defer_state_test/macros/macros.sql deleted file mode 100644 index 79519c1b6..000000000 --- a/tests/integration/defer_state_test/macros/macros.sql +++ /dev/null @@ -1,3 +0,0 @@ -{% macro my_macro() %} - {% do log('in a macro' ) %} -{% endmacro %} diff --git a/tests/integration/defer_state_test/models/ephemeral_model.sql b/tests/integration/defer_state_test/models/ephemeral_model.sql deleted file mode 100644 index 2f976e3a9..000000000 --- a/tests/integration/defer_state_test/models/ephemeral_model.sql +++ /dev/null @@ -1,2 +0,0 @@ -{{ config(materialized='ephemeral') }} -select * from {{ ref('view_model') }} diff --git a/tests/integration/defer_state_test/models/exposures.yml b/tests/integration/defer_state_test/models/exposures.yml deleted file mode 100644 index 489dec3c3..000000000 --- a/tests/integration/defer_state_test/models/exposures.yml +++ /dev/null @@ -1,8 +0,0 @@ -version: 2 -exposures: - - name: my_exposure - type: application - depends_on: - - ref('view_model') - owner: - email: test@example.com diff --git a/tests/integration/defer_state_test/models/schema.yml b/tests/integration/defer_state_test/models/schema.yml deleted file mode 100644 index 1ec506d3d..000000000 --- a/tests/integration/defer_state_test/models/schema.yml +++ /dev/null @@ -1,9 +0,0 @@ -version: 2 -models: - - name: view_model - columns: - - name: id - tests: - - unique - - not_null - - name: name diff --git a/tests/integration/defer_state_test/models/table_model.sql b/tests/integration/defer_state_test/models/table_model.sql deleted file mode 100644 index 65909318b..000000000 --- a/tests/integration/defer_state_test/models/table_model.sql +++ /dev/null @@ -1,5 +0,0 @@ -{{ config(materialized='table') }} -select * from {{ ref('ephemeral_model') }} - --- establish a macro dependency to trigger state:modified.macros --- depends on: {{ my_macro() }} \ No newline at end of file diff --git a/tests/integration/defer_state_test/models/view_model.sql b/tests/integration/defer_state_test/models/view_model.sql deleted file mode 100644 index 72cb07a5e..000000000 --- a/tests/integration/defer_state_test/models/view_model.sql +++ /dev/null @@ -1,4 +0,0 @@ -select * from {{ ref('seed') }} - --- establish a macro dependency that trips infinite recursion if not handled --- depends on: {{ my_infinitely_recursive_macro() }} \ No newline at end of file diff --git a/tests/integration/defer_state_test/seeds/seed.csv b/tests/integration/defer_state_test/seeds/seed.csv deleted file mode 100644 index 1a728c8ab..000000000 --- a/tests/integration/defer_state_test/seeds/seed.csv +++ /dev/null @@ -1,3 +0,0 @@ -id,name -1,Alice -2,Bob diff --git a/tests/integration/defer_state_test/test_defer_state.py b/tests/integration/defer_state_test/test_defer_state.py deleted file mode 100644 index ab319d0b1..000000000 --- a/tests/integration/defer_state_test/test_defer_state.py +++ /dev/null @@ -1,91 +0,0 @@ -from tests.integration.base import DBTIntegrationTest, use_profile -import copy -import json -import os -import shutil - -import pytest - - -class TestDeferState(DBTIntegrationTest): - @property - def schema(self): - return "defer_state" - - @property - def models(self): - return "models" - - def setUp(self): - self.other_schema = None - super().setUp() - self._created_schemas.add(self.other_schema) - - def tearDown(self): - with self.adapter.connection_named('__test'): - self._drop_schema_named(self.default_database, self.other_schema) - - super().tearDown() - - @property - def project_config(self): - return { - 'config-version': 2, - 'seeds': { - 'test': { - 'quote_columns': False, - } - } - } - - def get_profile(self, adapter_type): - if self.other_schema is None: - self.other_schema = self.unique_schema() + '_other' - profile = super().get_profile(adapter_type) - default_name = profile['test']['target'] - profile['test']['outputs']['otherschema'] = copy.deepcopy(profile['test']['outputs'][default_name]) - profile['test']['outputs']['otherschema']['schema'] = self.other_schema - return profile - - def copy_state(self): - assert not os.path.exists('state') - os.makedirs('state') - shutil.copyfile('target/manifest.json', 'state/manifest.json') - - def run_and_defer(self): - results = self.run_dbt(['seed']) - assert len(results) == 1 - assert not any(r.node.deferred for r in results) - results = self.run_dbt(['run']) - assert len(results) == 2 - assert not any(r.node.deferred for r in results) - results = self.run_dbt(['test']) - assert len(results) == 2 - - # copy files over from the happy times when we had a good target - self.copy_state() - - # test tests first, because run will change things - # no state, wrong schema, failure. - self.run_dbt(['test', '--target', 'otherschema'], expect_pass=False) - - # no state, run also fails - self.run_dbt(['run', '--target', 'otherschema'], expect_pass=False) - - # defer test, it succeeds - results = self.run_dbt(['test', '-m', 'view_model+', '--state', 'state', '--defer', '--target', 'otherschema']) - - # with state it should work though - results = self.run_dbt(['run', '-m', 'view_model', '--state', 'state', '--defer', '--target', 'otherschema']) - assert self.other_schema not in results[0].node.compiled_code - assert self.unique_schema() in results[0].node.compiled_code - - with open('target/manifest.json') as fp: - data = json.load(fp) - assert data['nodes']['seed.test.seed']['deferred'] - - assert len(results) == 1 - - @use_profile('bigquery') - def test_bigquery_state_changetarget(self): - self.run_and_defer()