-
Notifications
You must be signed in to change notification settings - Fork 1.6k
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
* convert 027 cycle test * remove no-op expect_pass=False * remove postgres from test names
- Loading branch information
1 parent
6c86094
commit 17b8266
Showing
10 changed files
with
71 additions
and
60 deletions.
There are no files selected for viewing
2 changes: 0 additions & 2 deletions
2
test/integration/027_cycle_tests/complex_cycle_models/model_a.sql
This file was deleted.
Oops, something went wrong.
4 changes: 0 additions & 4 deletions
4
test/integration/027_cycle_tests/complex_cycle_models/model_b.sql
This file was deleted.
Oops, something went wrong.
2 changes: 0 additions & 2 deletions
2
test/integration/027_cycle_tests/complex_cycle_models/model_c.sql
This file was deleted.
Oops, something went wrong.
2 changes: 0 additions & 2 deletions
2
test/integration/027_cycle_tests/complex_cycle_models/model_d.sql
This file was deleted.
Oops, something went wrong.
2 changes: 0 additions & 2 deletions
2
test/integration/027_cycle_tests/complex_cycle_models/model_e.sql
This file was deleted.
Oops, something went wrong.
This file was deleted.
Oops, something went wrong.
2 changes: 0 additions & 2 deletions
2
test/integration/027_cycle_tests/simple_cycle_models/model_a.sql
This file was deleted.
Oops, something went wrong.
2 changes: 0 additions & 2 deletions
2
test/integration/027_cycle_tests/simple_cycle_models/model_b.sql
This file was deleted.
Oops, something went wrong.
This file was deleted.
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,71 @@ | ||
import pytest | ||
|
||
from dbt.tests.util import run_dbt | ||
|
||
model_a_sql = """ | ||
select * from {{ ref('model_b') }} | ||
""" | ||
|
||
model_b_sql = """ | ||
select * from {{ ref('model_a') }} | ||
""" | ||
|
||
complex_cycle__model_a_sql = """ | ||
select 1 as id | ||
""" | ||
|
||
complex_cycle__model_b_sql = """ | ||
select * from {{ ref('model_a') }}s | ||
union all | ||
select * from {{ ref('model_e') }} | ||
""" | ||
|
||
complex_cycle__model_c_sql = """ | ||
select * from {{ ref('model_b') }} | ||
""" | ||
|
||
complex_cycle__model_d_sql = """ | ||
select * from {{ ref('model_c') }} | ||
""" | ||
|
||
complex_cycle__model_e_sql = """ | ||
select * from {{ ref('model_e') }} | ||
""" | ||
|
||
|
||
class TestSimpleCycle: | ||
@pytest.fixture(scope="class") | ||
def models(self): | ||
return { | ||
"model_a.sql": model_a_sql, | ||
"model_b.sql": model_b_sql | ||
} | ||
|
||
def test_simple_cycle(self, project): | ||
with pytest.raises(RuntimeError) as exc: | ||
run_dbt(["run"]) | ||
expected_msg = "Found a cycle" | ||
assert expected_msg in str(exc.value) | ||
|
||
|
||
class TestComplexCycle: | ||
@pytest.fixture(scope="class") | ||
def models(self): | ||
# The cycle in this graph looks like: | ||
# A -> B -> C -> D | ||
# ^ | | ||
# | | | ||
# +--- E <--+ | ||
return { | ||
"model_a.sql": complex_cycle__model_a_sql, | ||
"model_b.sql": complex_cycle__model_b_sql, | ||
"model_c.sql": complex_cycle__model_c_sql, | ||
"model_d.sql": complex_cycle__model_d_sql, | ||
"model_e.sql": complex_cycle__model_e_sql, | ||
} | ||
|
||
def test_complex_cycle(self, project): | ||
with pytest.raises(RuntimeError) as exc: | ||
run_dbt(["run"]) | ||
expected_msg = "Found a cycle" | ||
assert expected_msg in str(exc.value) |