Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Skip distributed tests if cluster is not provided #343

Merged
merged 4 commits into from
Aug 21, 2024
Merged
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
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