Skip to content

Commit

Permalink
skip distributed tests if cluster is not provided
Browse files Browse the repository at this point in the history
  • Loading branch information
BentsiLeviav committed Aug 21, 2024
1 parent a9042ad commit ec35fb3
Showing 1 changed file with 13 additions and 0 deletions.
13 changes: 13 additions & 0 deletions tests/integration/adapter/incremental/test_schema_change.py
Original file line number Diff line number Diff line change
@@ -1,4 +1,5 @@
from functools import reduce
import os

import pytest
from dbt.tests.util import run_dbt, run_dbt_and_capture
Expand Down Expand Up @@ -44,6 +45,8 @@ def models(self):

@pytest.mark.parametrize("model", ("schema_change_ignore", "schema_change_distributed_ignore"))
def test_ignore(self, project, model):
if model == "schema_change_distributed_ignore" and os.environ.get('DBT_CH_TEST_CLUSTER', '').strip() == '':
pytest.skip("Not on a cluster")
run_dbt(["run", "--select", model])
result = project.run_sql(f"select * from {model} order by col_1", fetch="all")
assert len(result) == 3
Expand All @@ -54,6 +57,8 @@ def test_ignore(self, project, model):

@pytest.mark.parametrize("model", ("schema_change_fail", "schema_change_distributed_fail"))
def test_fail(self, project, model):
if model == "schema_change_distributed_fail" and os.environ.get('DBT_CH_TEST_CLUSTER', '').strip() == '':
pytest.skip("Not on a cluster")
run_dbt(["run", "--select", model])
result = project.run_sql(f"select * from {model} order by col_1", fetch="all")
assert len(result) == 3
Expand All @@ -70,6 +75,8 @@ def test_fail(self, project, model):

@pytest.mark.parametrize("model", ("schema_change_append", "schema_change_distributed_append"))
def test_append(self, project, model):
if model == "schema_change_distributed_append" and os.environ.get('DBT_CH_TEST_CLUSTER', '').strip() == '':
pytest.skip("Not on a cluster")
run_dbt(["run", "--select", model])
result = project.run_sql(f"select * from {model} order by col_1", fetch="all")
assert len(result) == 3
Expand Down Expand Up @@ -131,6 +138,8 @@ def models(self):
),
)
def test_fail(self, project, model):
if "distributed" in model and os.environ.get('DBT_CH_TEST_CLUSTER', '').strip() == '':
pytest.skip("Not on a cluster")
run_dbt(["run", "--select", model])
result = project.run_sql(f"select * from {model} order by col_1", fetch="all")
assert len(result) == 3
Expand All @@ -149,6 +158,8 @@ def test_fail(self, project, model):
"model", ("complex_schema_change_sync", "complex_schema_change_distributed_sync")
)
def test_sync(self, project, model):
if model == "complex_schema_change_distributed_sync" and os.environ.get('DBT_CH_TEST_CLUSTER', '').strip() == '':
pytest.skip("Not on a cluster")
run_dbt(["run", "--select", model])
result = project.run_sql(f"select * from {model} order by col_1", fetch="all")
assert len(result) == 3
Expand Down Expand Up @@ -196,6 +207,8 @@ def models(self):

@pytest.mark.parametrize("model", ("out_of_order_columns", "out_of_order_columns_distributed"))
def test_reordering(self, project, model):
if model == "out_of_order_columns_distributed" and os.environ.get('DBT_CH_TEST_CLUSTER', '').strip() == '':
pytest.skip("Not on a cluster")
run_dbt(["run", "--select", model])
result = project.run_sql(f"select * from {model} order by col_1", fetch="all")
assert result[0][1] == 1
Expand Down

0 comments on commit ec35fb3

Please sign in to comment.