-
Notifications
You must be signed in to change notification settings - Fork 1.7k
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
Declare compatibility for previous artifact versions (#5346)
* Add functional test * Add is_compatible_version logic * Add changelog entry * Fix mypy
- Loading branch information
Showing
9 changed files
with
76 additions
and
1 deletion.
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
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,8 @@ | ||
kind: Fixes | ||
body: 'Define compatibility for older manifest versions when using state: selection | ||
methods' | ||
time: 2022-06-08T08:09:14.321735+02:00 | ||
custom: | ||
Author: jtcohen6 | ||
Issue: "5213" | ||
PR: "5346" |
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
Large diffs are not rendered by default.
Oops, something went wrong.
Large diffs are not rendered by default.
Oops, something went wrong.
Large diffs are not rendered by default.
Oops, something went wrong.
Large diffs are not rendered by default.
Oops, something went wrong.
Large diffs are not rendered by default.
Oops, something went wrong.
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,50 @@ | ||
import pytest | ||
import os | ||
from dbt.tests.util import run_dbt | ||
from dbt.exceptions import IncompatibleSchemaException | ||
|
||
models__my_model_sql = """ | ||
select 1 as id | ||
""" | ||
|
||
|
||
class TestPreviousVersionState: | ||
@pytest.fixture(scope="class") | ||
def models(self): | ||
return {"my_model.sql": models__my_model_sql} | ||
|
||
def compare_previous_state( | ||
self, | ||
project, | ||
compare_manifest_version, | ||
expect_pass, | ||
): | ||
state_path = os.path.join(project.test_data_dir, f"previous/{compare_manifest_version}") | ||
cli_args = [ | ||
"list", | ||
"--select", | ||
"state:modified", | ||
"--state", | ||
state_path, | ||
] | ||
if expect_pass: | ||
results = run_dbt(cli_args, expect_pass=expect_pass) | ||
assert len(results) == 0 | ||
else: | ||
with pytest.raises(IncompatibleSchemaException): | ||
run_dbt(cli_args, expect_pass=expect_pass) | ||
|
||
def test_compare_state_v5(self, project): | ||
self.compare_previous_state(project, "v5", True) | ||
|
||
def test_compare_state_v4(self, project): | ||
self.compare_previous_state(project, "v4", True) | ||
|
||
def test_compare_state_v3(self, project): | ||
self.compare_previous_state(project, "v3", False) | ||
|
||
def test_compare_state_v2(self, project): | ||
self.compare_previous_state(project, "v2", False) | ||
|
||
def test_compare_state_v1(self, project): | ||
self.compare_previous_state(project, "v1", False) |