Skip to content

Commit

Permalink
all tests passing on new infra
Browse files Browse the repository at this point in the history
  • Loading branch information
benc-db committed Aug 15, 2023
1 parent b632484 commit 4b82459
Show file tree
Hide file tree
Showing 26 changed files with 117 additions and 278 deletions.
2 changes: 0 additions & 2 deletions test.env.example
Original file line number Diff line number Diff line change
Expand Up @@ -7,8 +7,6 @@ DBT_DATABRICKS_HTTP_PATH=
## Also able to set the http-path values for each profile
## Server http-path value for `databricks_cluster` profile
# DBT_DATABRICKS_CLUSTER_HTTP_PATH=
## Server http-path value for `databricks_sql_endpoint` profile
# DBT_DATABRICKS_ENDPOINT_HTTP_PATH=
## Server http-path value for `databricks_uc_cluster` profile
# DBT_DATABRICKS_UC_CLUSTER_HTTP_PATH=
## Server http-path value for `databricks_uc_sql_endpoint` profile
Expand Down
8 changes: 4 additions & 4 deletions tests/functional/adapter/test_changing_relation_type.py
Original file line number Diff line number Diff line change
@@ -1,15 +1,15 @@
import pytest

from dbt.tests.adapter.relations.test_changing_relation_type import BaseChangeRelationTypeValidator
from dbt.tests.adapter.relations.test_changing_relation_type import (
BaseChangeRelationTypeValidator,
)


class TestChangeRelationTypesDatabricks(BaseChangeRelationTypeValidator):
pass


@pytest.mark.skip_profile(
"databricks_uc_cluster", "databricks_sql_endpoint", "databricks_uc_sql_endpoint"
)
@pytest.mark.skip_profile("databricks_uc_cluster", "databricks_uc_sql_endpoint")
class TestChangeRelationTypesParquetDatabricks(BaseChangeRelationTypeValidator):
@pytest.fixture(scope="class")
def project_config_update(self):
Expand Down
14 changes: 7 additions & 7 deletions tests/functional/adapter/test_constraints.py
Original file line number Diff line number Diff line change
Expand Up @@ -75,7 +75,7 @@ def data_types(self, schema_int_type, int_type, string_type):
]


@pytest.mark.skip_profile("databricks_sql_endpoint", "databricks_cluster")
@pytest.mark.skip_profile("databricks_cluster")
class TestSparkTableConstraintsColumnsEqualDatabricksHTTP(
DatabricksHTTPSetup, BaseTableConstraintsColumnsEqual
):
Expand All @@ -88,7 +88,7 @@ def models(self):
}


@pytest.mark.skip_profile("databricks_sql_endpoint", "databricks_cluster")
@pytest.mark.skip_profile("databricks_cluster")
class TestSparkViewConstraintsColumnsEqualDatabricksHTTP(
DatabricksHTTPSetup, BaseViewConstraintsColumnsEqual
):
Expand All @@ -101,7 +101,7 @@ def models(self):
}


@pytest.mark.skip_profile("databricks_sql_endpoint", "databricks_cluster")
@pytest.mark.skip_profile("databricks_cluster")
class TestSparkIncrementalConstraintsColumnsEqualDatabricksHTTP(
DatabricksHTTPSetup, BaseIncrementalConstraintsColumnsEqual
):
Expand All @@ -128,7 +128,7 @@ def expected_sql(self):
return _expected_sql_spark


@pytest.mark.skip_profile("databricks_sql_endpoint", "databricks_cluster")
@pytest.mark.skip_profile("databricks_cluster")
class TestSparkTableConstraintsDdlEnforcement(
BaseSparkConstraintsDdlEnforcementSetup, BaseConstraintsRuntimeDdlEnforcement
):
Expand All @@ -140,7 +140,7 @@ def models(self):
}


@pytest.mark.skip_profile("databricks_sql_endpoint", "databricks_cluster")
@pytest.mark.skip_profile("databricks_cluster")
class TestSparkIncrementalConstraintsDdlEnforcement(
BaseSparkConstraintsDdlEnforcementSetup,
BaseIncrementalConstraintsRuntimeDdlEnforcement,
Expand Down Expand Up @@ -179,7 +179,7 @@ def assert_expected_error_messages(self, error_message, expected_error_messages)
assert any(msg in error_message for msg in expected_error_messages)


@pytest.mark.skip_profile("databricks_sql_endpoint", "databricks_cluster")
@pytest.mark.skip_profile("databricks_cluster")
class TestSparkTableConstraintsRollback(BaseSparkConstraintsRollbackSetup, BaseConstraintsRollback):
@pytest.fixture(scope="class")
def models(self):
Expand All @@ -196,7 +196,7 @@ def expected_color(self):
return "red"


@pytest.mark.skip_profile("databricks_sql_endpoint", "databricks_cluster")
@pytest.mark.skip_profile("databricks_cluster")
class TestSparkIncrementalConstraintsRollback(
BaseSparkConstraintsRollbackSetup, BaseIncrementalConstraintsRollback
):
Expand Down
10 changes: 5 additions & 5 deletions tests/functional/adapter/test_grants.py
Original file line number Diff line number Diff line change
Expand Up @@ -7,7 +7,7 @@


@pytest.mark.skip(reason="DECO team must provide DBT_TEST_USER_1/2/3 before we re-enable")
# @pytest.mark.skip_profile("databricks_cluster", "databricks_sql_endpoint")
# @pytest.mark.skip_profile("databricks_cluster")
class TestModelGrantsDatabricks(BaseModelGrants):
def privilege_grantee_name_overrides(self):
# insert --> modify
Expand All @@ -20,13 +20,13 @@ def privilege_grantee_name_overrides(self):


@pytest.mark.skip(reason="DECO team must provide DBT_TEST_USER_1/2/3 before we re-enable")
# @pytest.mark.skip_profile("databricks_cluster", "databricks_sql_endpoint")
# @pytest.mark.skip_profile("databricks_cluster")
class TestIncrementalGrantsDatabricks(BaseIncrementalGrants):
pass


@pytest.mark.skip(reason="DECO team must provide DBT_TEST_USER_1/2/3 before we re-enable")
# @pytest.mark.skip_profile("databricks_cluster", "databricks_sql_endpoint")
# @pytest.mark.skip_profile("databricks_cluster")
class TestSeedGrantsDatabricks(BaseSeedGrants):
# seeds in dbt-spark are currently "full refreshed," in such a way that
# the grants are not carried over
Expand All @@ -36,13 +36,13 @@ def seeds_support_partial_refresh(self):


@pytest.mark.skip(reason="DECO team must provide DBT_TEST_USER_1/2/3 before we re-enable")
# @pytest.mark.skip_profile("databricks_cluster", "databricks_sql_endpoint")
# @pytest.mark.skip_profile("databricks_cluster")
class TestSnapshotGrantsDatabricks(BaseSnapshotGrants):
pass


@pytest.mark.skip(reason="DECO team must provide DBT_TEST_USER_1/2/3 before we re-enable")
# @pytest.mark.skip_profile("databricks_cluster", "databricks_sql_endpoint")
# @pytest.mark.skip_profile("databricks_cluster")
class TestInvalidGrantsDatabricks(BaseInvalidGrants):
def grantee_does_not_exist_error(self):
return "PRINCIPAL_DOES_NOT_EXIST"
Expand Down
8 changes: 4 additions & 4 deletions tests/functional/adapter/test_python_model.py
Original file line number Diff line number Diff line change
Expand Up @@ -15,12 +15,12 @@
)


@pytest.mark.skip_profile("databricks_sql_endpoint", "databricks_uc_sql_endpoint")
@pytest.mark.skip_profile("databricks_uc_sql_endpoint")
class TestPythonModelDatabricks(BasePythonModelTests):
pass


@pytest.mark.skip_profile("databricks_sql_endpoint", "databricks_uc_sql_endpoint")
@pytest.mark.skip_profile("databricks_uc_sql_endpoint")
class TestPythonIncrementalModelDatabricks(BasePythonIncrementalTests):
@pytest.fixture(scope="class")
def project_config_update(self):
Expand Down Expand Up @@ -49,7 +49,7 @@ def model(dbt, spark):
"""


@pytest.mark.skip_profile("databricks_sql_endpoint", "databricks_uc_sql_endpoint")
@pytest.mark.skip_profile("databricks_uc_sql_endpoint")
class TestChangingSchemaDatabricks:
@pytest.fixture(scope="class")
def models(self):
Expand All @@ -72,7 +72,7 @@ def test_changing_schema_with_log_validation(self, project, logs_dir):
assert "Execution status: OK in" in log


@pytest.mark.skip_profile("databricks_sql_endpoint", "databricks_uc_sql_endpoint")
@pytest.mark.skip_profile("databricks_uc_sql_endpoint")
class TestPySparkDatabricks(BasePySparkTests):
@pytest.fixture(scope="class")
def models(self):
Expand Down
1 change: 0 additions & 1 deletion tests/integration/base.py
Original file line number Diff line number Diff line change
Expand Up @@ -96,7 +96,6 @@ def _profile_from_test_name(test_name):
adapter_names = (
"databricks_cluster",
"databricks_uc_cluster",
"databricks_sql_endpoint",
"databricks_uc_sql_endpoint",
)
adapters_in_name = sum(x in test_name for x in adapter_names)
Expand Down
1 change: 0 additions & 1 deletion tests/integration/conftest.py
Original file line number Diff line number Diff line change
@@ -1,5 +1,4 @@
def pytest_configure(config):
config.addinivalue_line("markers", "profile_databricks_cluster")
config.addinivalue_line("markers", "profile_databricks_uc_cluster")
config.addinivalue_line("markers", "profile_databricks_sql_endpoint")
config.addinivalue_line("markers", "profile_databricks_uc_sql_endpoint")
14 changes: 4 additions & 10 deletions tests/integration/copy_into/test_copy_into.py
Original file line number Diff line number Diff line change
Expand Up @@ -44,7 +44,8 @@ def prepare(self):
raise Exception("No location found for the source table")
return path

def test_copy_into(self):
@use_profile("databricks_cluster")
def test_copy_into_databricks_cluster(self):
path = self.prepare()

self.run_dbt(
Expand All @@ -57,7 +58,8 @@ def test_copy_into(self):
)
self.assertTablesEqual("target", "expected_target")

def test_copy_into_with_expression_list(self):
@use_profile("databricks_cluster")
def test_copy_into_with_expression_list_databricks_cluster(self):
path = self.prepare()

self.run_dbt(
Expand All @@ -71,11 +73,3 @@ def test_copy_into_with_expression_list(self):
self.assertTablesEqual(
"target_with_expression_list", "expected_target_with_expression_list"
)

@use_profile("databricks_cluster")
def test_copy_into_databricks_cluster(self):
self.test_copy_into()

@use_profile("databricks_cluster")
def test_copy_into_with_expression_list_databricks_cluster(self):
self.test_copy_into_with_expression_list()
4 changes: 0 additions & 4 deletions tests/integration/debug/test_debug.py
Original file line number Diff line number Diff line change
Expand Up @@ -26,10 +26,6 @@ def run_and_test(self, contains_catalog: bool):
def test_debug_databricks_cluster(self):
self.run_and_test(contains_catalog=False)

@use_profile("databricks_sql_endpoint")
def test_debug_databricks_sql_endpoint(self):
self.run_and_test(contains_catalog=False)

@use_profile("databricks_uc_cluster")
def test_debug_databricks_uc_cluster(self):
self.run_and_test(contains_catalog=True)
Expand Down
12 changes: 4 additions & 8 deletions tests/integration/fail_fast/test_fail_fast.py
Original file line number Diff line number Diff line change
Expand Up @@ -12,7 +12,7 @@ def schema(self):
def models(self):
return "models"

def test_fail_fast(self):
def _test_fail_fast(self):
self.run_dbt(["run"])

# PECO-738 Original except message we tested for was:
Expand All @@ -30,16 +30,12 @@ def test_fail_fast(self):

@use_profile("databricks_cluster")
def test_fail_fast_databricks_cluster(self):
self.test_fail_fast()
self._test_fail_fast()

@use_profile("databricks_uc_cluster")
def test_fail_fast_databricks_uc_cluster(self):
self.test_fail_fast()

@use_profile("databricks_sql_endpoint")
def test_fail_fast_databricks_sql_endpoint(self):
self.test_fail_fast()
self._test_fail_fast()

@use_profile("databricks_uc_sql_endpoint")
def test_fail_fast_databricks_uc_sql_endpoint(self):
self.test_fail_fast()
self._test_fail_fast()
Original file line number Diff line number Diff line change
Expand Up @@ -22,10 +22,6 @@ def test_get_columns_in_relation_in_same_run_databricks_cluster(self):
def test_get_columns_in_relation_in_same_run_databricks_uc_cluster(self):
self.run_and_test()

@use_profile("databricks_sql_endpoint")
def test_get_columns_in_relation_in_same_run_databricks_sql_endpoint(self):
self.run_and_test()

@use_profile("databricks_uc_sql_endpoint")
def test_get_columns_in_relation_in_same_run_databricks_uc_sql_endpoint(self):
self.run_and_test()
Original file line number Diff line number Diff line change
Expand Up @@ -15,7 +15,6 @@ def project_config(self):
return {"config-version": 2, "test-paths": ["tests"]}

def run_twice_and_assert(self, include, compare_source, compare_target):

# dbt run (twice)
run_args = ["run"]
if include:
Expand Down Expand Up @@ -89,18 +88,6 @@ def test__databricks_uc_cluster__run_incremental_fail_on_schema_change(self):
def test__databricks_uc_cluster__run_incremental_sync_all_columns(self):
self.run_incremental_sync_all_columns()

@use_profile("databricks_sql_endpoint")
def test__databricks_sql_endpoint__run_incremental_ignore(self):
self.run_incremental_ignore()

@use_profile("databricks_sql_endpoint")
def test__databricks_sql_endpoint__run_incremental_fail_on_schema_change(self):
self.run_incremental_fail_on_schema_change()

@use_profile("databricks_sql_endpoint")
def test__databricks_sql_endpoint__run_incremental_sync_all_columns(self):
self.run_incremental_sync_all_columns()

@use_profile("databricks_uc_sql_endpoint")
def test__databricks_uc_sql_endpoint__run_incremental_ignore(self):
self.run_incremental_ignore()
Expand Down Expand Up @@ -157,22 +144,6 @@ def test__databricks_uc_cluster__run_incremental_append_new_columns(self):
def test__databricks_uc_cluster__run_incremental_sync_all_columns(self):
self.run_incremental_sync_all_columns()

@use_profile("databricks_sql_endpoint")
def test__databricks_sql_endpoint__run_incremental_ignore(self):
self.run_incremental_ignore()

@use_profile("databricks_sql_endpoint")
def test__databricks_sql_endpoint__run_incremental_fail_on_schema_change(self):
self.run_incremental_fail_on_schema_change()

@use_profile("databricks_sql_endpoint")
def test__databricks_sql_endpoint__run_incremental_append_new_columns(self):
self.run_incremental_append_new_columns()

@use_profile("databricks_sql_endpoint")
def test__databricks_sql_endpoint__run_incremental_sync_all_columns(self):
self.run_incremental_sync_all_columns()

@use_profile("databricks_uc_sql_endpoint")
def test__databricks_uc_sql_endpoint__run_incremental_ignore(self):
self.run_incremental_ignore()
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -67,10 +67,6 @@ def run_and_test_warehouse(self):
self.assertTablesEqual("merge_exclude_columns", "expected_exclude_upsert")
self.assertTablesEqual("replace_where", "expected_replace_where")

@use_profile("databricks_sql_endpoint")
def test_delta_strategies_databricks_sql_endpoint(self):
self.run_and_test_warehouse()

@use_profile("databricks_uc_sql_endpoint")
def test_delta_strategies_databricks_uc_sql_endpoint(self):
self.run_and_test_warehouse()
Expand Down Expand Up @@ -130,10 +126,6 @@ def test_bad_strategies_databricks_cluster(self):
def test_bad_strategies_databricks_uc_cluster(self):
self.run_and_test()

@use_profile("databricks_sql_endpoint")
def test_bad_strategies_databricks_sql_endpoint(self):
self.run_and_test()

@use_profile("databricks_uc_sql_endpoint")
def test_bad_strategies_databricks_uc_sql_endpoint(self):
self.run_and_test()
12 changes: 6 additions & 6 deletions tests/integration/materialized_view/test_materialized_view.py
Original file line number Diff line number Diff line change
Expand Up @@ -12,7 +12,7 @@ def schema(self):
def models(self):
return "models"

def test_materialized_view_base(self):
def _test_materialized_view_base(self):
self.run_dbt(["seed"])
self.run_dbt(["run", "--select", "+mv"])

Expand All @@ -30,7 +30,7 @@ def test_materialized_view_base(self):
self.run_dbt(["run", "--full-refresh", "--select", "mv"])
self.assertTablesEqual("mv", "expected2")

def test_materialized_view_no_cdf(self):
def _test_materialized_view_no_cdf(self):
# The base table is not CDF.
result = self.run_dbt(["run", "--select", "+mv_nocdf"], expect_pass=False)
assert len(result.results) == 2
Expand All @@ -41,7 +41,7 @@ def test_materialized_view_no_cdf(self):
and "The input for materialized view must have Change Data Feed enabled." in res.message
)

def test_materialized_view_based_on_view(self):
def _test_materialized_view_based_on_view(self):
result = self.run_dbt(["run", "--select", "+mv_on_view"], expect_pass=False)
assert len(result.results) == 3
res: RunResult = result.results[2]
Expand All @@ -54,14 +54,14 @@ def test_materialized_view_based_on_view(self):
@pytest.mark.skip(reason="not yet ready for production")
@use_profile("databricks_uc_sql_endpoint")
def test_materialized_view_base_databricks_uc_sql_endpoint(self):
self.test_materialized_view_base()
self._test_materialized_view_base()

@pytest.mark.skip(reason="not yet ready for production")
@use_profile("databricks_uc_sql_endpoint")
def test_materialized_view_no_cdf_databricks_uc_sql_endpoint(self):
self.test_materialized_view_no_cdf()
self._test_materialized_view_no_cdf()

@pytest.mark.skip(reason="not yet ready for production")
@use_profile("databricks_uc_sql_endpoint")
def test_materialized_view_based_on_view_databricks_uc_sql_endpoint(self):
self.test_materialized_view_based_on_view()
self._test_materialized_view_based_on_view()
Loading

0 comments on commit 4b82459

Please sign in to comment.