Skip to content

Commit

Permalink
pull new test out of old OnSchemaChange, to create own bass and test …
Browse files Browse the repository at this point in the history
…class
  • Loading branch information
McKnight-42 committed Jul 16, 2024
1 parent 0cb0583 commit 52cb472
Showing 1 changed file with 24 additions and 13 deletions.
Original file line number Diff line number Diff line change
Expand Up @@ -20,8 +20,6 @@ def models(self):
"incremental_append_new_columns.sql": fixtures._MODELS__INCREMENTAL_APPEND_NEW_COLUMNS,
"incremental_sync_all_columns_target.sql": fixtures._MODELS__INCREMENTAL_SYNC_ALL_COLUMNS_TARGET,
"incremental_append_new_columns_remove_one_target.sql": fixtures._MODELS__INCREMENTAL_APPEND_NEW_COLUMNS_REMOVE_ONE_TARGET,
"src_artists.sql": fixtures._MODELS__SRC_ARTISTS,
"dim_artists.sql": fixtures._MODELS__DIM_ARTISTS,
}

def run_twice_and_assert(self, include, compare_source, compare_target, project):
Expand Down Expand Up @@ -73,6 +71,29 @@ def test_run_incremental_append_new_columns(self, project):
self.run_incremental_append_new_columns(project)
self.run_incremental_append_new_columns_remove_one(project)

def test_run_incremental_sync_all_columns(self, project):
self.run_incremental_sync_all_columns(project)
self.run_incremental_sync_remove_only(project)

def test_run_incremental_fail_on_schema_change(self, project):
select = "model_a incremental_fail"
run_dbt(["run", "--models", select, "--full-refresh"])
results_two = run_dbt(["run", "--models", select], expect_pass=False)
assert "Compilation Error" in results_two[1].message


class TestIncrementalOnSchemaChange(BaseIncrementalOnSchemaChange):
pass


class BaseIncrementalCaseSenstivityOnSchemaChange:
@pytest.fixture(scope="class")
def models(self):
return {
"src_artists.sql": fixtures._MODELS__SRC_ARTISTS,
"dim_artists.sql": fixtures._MODELS__DIM_ARTISTS,
}

def test_run_incremental_check_quoting_on_new_columns(self, project):
select = "src_artists dim_artists"
run_dbt(["run", "--models", select, "--full-refresh"])
Expand All @@ -88,16 +109,6 @@ def test_run_incremental_check_quoting_on_new_columns(self, project):
)
assert "Job" in logs

def test_run_incremental_sync_all_columns(self, project):
self.run_incremental_sync_all_columns(project)
self.run_incremental_sync_remove_only(project)

def test_run_incremental_fail_on_schema_change(self, project):
select = "model_a incremental_fail"
run_dbt(["run", "--models", select, "--full-refresh"])
results_two = run_dbt(["run", "--models", select], expect_pass=False)
assert "Compilation Error" in results_two[1].message


class TestIncrementalOnSchemaChange(BaseIncrementalOnSchemaChange):
class TestIncrementalCaseSenstivityOnSchemaChange(BaseIncrementalCaseSenstivityOnSchemaChange):
pass

0 comments on commit 52cb472

Please sign in to comment.