Skip to content

Commit

Permalink
Merge pull request #343 from ClickHouse/skip-tests-if-not-on-cluster
Browse files Browse the repository at this point in the history
Skip distributed tests if cluster is not provided
  • Loading branch information
BentsiLeviav authored Aug 21, 2024
2 parents a9042ad + 8a5b96a commit 08ed52f
Showing 1 changed file with 28 additions and 0 deletions.
28 changes: 28 additions & 0 deletions tests/integration/adapter/incremental/test_schema_change.py
Original file line number Diff line number Diff line change
@@ -1,3 +1,4 @@
import os
from functools import reduce

import pytest
Expand Down Expand Up @@ -44,6 +45,11 @@ 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 +60,11 @@ 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 +81,11 @@ 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 +147,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 +167,11 @@ 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 +219,11 @@ 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 08ed52f

Please sign in to comment.