diff --git a/tests/functional/adapter/basic/test_adapter_methods.py b/tests/functional/adapter/basic/test_adapter_methods.py new file mode 100644 index 000000000..b307fd46d --- /dev/null +++ b/tests/functional/adapter/basic/test_adapter_methods.py @@ -0,0 +1,12 @@ +from dbt.tests.adapter.basic.test_adapter_methods import BaseAdapterMethod + + +class TestDatabricksAdapterMethod(BaseAdapterMethod): + """Currently this exercises: + * get_columns_in_relation + * get_relation + * drop_schema + * create_schema + """ + + pass diff --git a/tests/functional/adapter/dbt_debug/test_dbt_debug.py b/tests/functional/adapter/dbt_debug/test_dbt_debug.py new file mode 100644 index 000000000..fbc096513 --- /dev/null +++ b/tests/functional/adapter/dbt_debug/test_dbt_debug.py @@ -0,0 +1,13 @@ +from dbt.tests.adapter.dbt_debug.test_dbt_debug import BaseDebug +from dbt.tests import util + + +class TestDatabricksDebug(BaseDebug): + def test_ok(self, project): + util.run_dbt(["debug"]) + stdout = self.capsys.readouterr().out + assert "ERROR" not in stdout + assert "host:" in stdout + assert "http_path:" in stdout + assert "schema:" in stdout + assert "catalog:" in stdout diff --git a/tests/integration/current_catalog/models/current_catalog.sql b/tests/integration/current_catalog/models/current_catalog.sql deleted file mode 100644 index d62bd4493..000000000 --- a/tests/integration/current_catalog/models/current_catalog.sql +++ /dev/null @@ -1 +0,0 @@ -SELECT current_catalog() as cat diff --git a/tests/integration/current_catalog/models/expected.sql b/tests/integration/current_catalog/models/expected.sql deleted file mode 100644 index dbf394d0f..000000000 --- a/tests/integration/current_catalog/models/expected.sql +++ /dev/null @@ -1 +0,0 @@ -SELECT '{{ env_var('DBT_DATABRICKS_UC_INITIAL_CATALOG', 'main') }}' as cat diff --git a/tests/integration/current_catalog/test_current_catalog.py b/tests/integration/current_catalog/test_current_catalog.py deleted file mode 100644 index 156d7896a..000000000 --- a/tests/integration/current_catalog/test_current_catalog.py +++ /dev/null @@ -1,29 +0,0 @@ -from tests.integration.base import DBTIntegrationTest, use_profile - - -class TestCurrentCatalog(DBTIntegrationTest): - @property - def schema(self): - return "current_catalog" - - @property - def models(self): - return "models" - - def unity_catalog_enabled(self): - results = self.run_sql("SET spark.databricks.unityCatalog.enabled", fetch="all") - self.assertEqual(len(results), 1) - self.assertEqual(results[0][1], "true") - - def run_and_test(self): - self.run_dbt(["run"]) - self.assertTablesEqual("current_catalog", "expected") - - @use_profile("databricks_uc_cluster") - def test_current_catalog_databricks_uc_cluster(self): - self.unity_catalog_enabled() - self.run_and_test() - - @use_profile("databricks_uc_sql_endpoint") - def test_current_catalog_databricks_uc_sql_endpoint(self): - self.run_and_test() diff --git a/tests/integration/debug/test_debug.py b/tests/integration/debug/test_debug.py deleted file mode 100644 index 2bcb0b27f..000000000 --- a/tests/integration/debug/test_debug.py +++ /dev/null @@ -1,35 +0,0 @@ -from io import StringIO -from unittest import mock - -from tests.integration.base import DBTIntegrationTest, use_profile - - -class TestDebug(DBTIntegrationTest): - @property - def schema(self): - return "debug" - - @property - def models(self): - return "models" - - def run_and_test(self): - with mock.patch("sys.stdout", new=StringIO()) as fake_out: - self.run_dbt(["debug"]) - stdout = fake_out.getvalue() - self.assertIn("host: ", stdout) - self.assertIn("http_path: ", stdout) - self.assertIn("schema: ", stdout) - self.assertIn("catalog: ", stdout) - - @use_profile("databricks_cluster") - def test_debug_databricks_cluster(self): - self.run_and_test() - - @use_profile("databricks_uc_cluster") - def test_debug_databricks_uc_cluster(self): - self.run_and_test() - - @use_profile("databricks_uc_sql_endpoint") - def test_debug_databricks_uc_sql_endpoint(self): - self.run_and_test() diff --git a/tests/integration/fail_fast/models/schema.yml b/tests/integration/fail_fast/models/schema.yml deleted file mode 100644 index be559b206..000000000 --- a/tests/integration/fail_fast/models/schema.yml +++ /dev/null @@ -1,9 +0,0 @@ -version: 2 - -models: - - name: view_model - columns: - - name: id - tests: - - unique - - not_null diff --git a/tests/integration/fail_fast/models/view_model.sql b/tests/integration/fail_fast/models/view_model.sql deleted file mode 100644 index 2ff36b4e2..000000000 --- a/tests/integration/fail_fast/models/view_model.sql +++ /dev/null @@ -1,5 +0,0 @@ -select 1 as id -union all -select 1 as id -union all -select null as id diff --git a/tests/integration/fail_fast/test_fail_fast.py b/tests/integration/fail_fast/test_fail_fast.py deleted file mode 100644 index 317592629..000000000 --- a/tests/integration/fail_fast/test_fail_fast.py +++ /dev/null @@ -1,41 +0,0 @@ -from dbt.exceptions import FailFastError - -from tests.integration.base import DBTIntegrationTest, use_profile - - -class TesFailFast(DBTIntegrationTest): - @property - def schema(self): - return "fail_fast" - - @property - def models(self): - return "models" - - def _test_fail_fast(self): - self.run_dbt(["run"]) - - # PECO-738 Original except message we tested for was: - # - # 'Failing early due to test failure or runtime error' - # - # This is supposed to raise a FailFastException but that - # is being swallowed by the test runner and only the DBT - # test failure error message is raised instead. - _ = FailFastError - with self.assertRaisesRegex( - Exception, "False != True : dbt exit state did not match expected" - ): - self.run_dbt(["test", "--fail-fast"]) - - @use_profile("databricks_cluster") - def test_fail_fast_databricks_cluster(self): - self._test_fail_fast() - - @use_profile("databricks_uc_cluster") - def test_fail_fast_databricks_uc_cluster(self): - self._test_fail_fast() - - @use_profile("databricks_uc_sql_endpoint") - def test_fail_fast_databricks_uc_sql_endpoint(self): - self._test_fail_fast() diff --git a/tests/integration/get_columns_in_relation/models/child.sql b/tests/integration/get_columns_in_relation/models/child.sql deleted file mode 100644 index 2e3761f7a..000000000 --- a/tests/integration/get_columns_in_relation/models/child.sql +++ /dev/null @@ -1 +0,0 @@ -SELECT 1 diff --git a/tests/integration/get_columns_in_relation/models/get_columns_from_child.sql b/tests/integration/get_columns_in_relation/models/get_columns_from_child.sql deleted file mode 100644 index 3e4763367..000000000 --- a/tests/integration/get_columns_in_relation/models/get_columns_from_child.sql +++ /dev/null @@ -1,6 +0,0 @@ -SELECT - {% set cols = adapter.get_columns_in_relation(ref('child')) %} - {% for col in cols %} - {{ adapter.quote(col.column) }}{%- if not loop.last %},{{ '\n ' }}{% endif %} - {% endfor %} -FROM {{ ref('child') }} diff --git a/tests/integration/get_columns_in_relation/test_get_columns_in_relation.py b/tests/integration/get_columns_in_relation/test_get_columns_in_relation.py deleted file mode 100644 index b0ceb0dda..000000000 --- a/tests/integration/get_columns_in_relation/test_get_columns_in_relation.py +++ /dev/null @@ -1,27 +0,0 @@ -from tests.integration.base import DBTIntegrationTest, use_profile - - -class TestGetColumnInRelationInSameRun(DBTIntegrationTest): - @property - def schema(self): - return "get_columns_in_relation" - - @property - def models(self): - return "models" - - def run_and_test(self): - self.run_dbt(["run"]) - self.assertTablesEqual("child", "get_columns_from_child") - - @use_profile("databricks_cluster") - def test_get_columns_in_relation_in_same_run_databricks_cluster(self): - self.run_and_test() - - @use_profile("databricks_uc_cluster") - def test_get_columns_in_relation_in_same_run_databricks_uc_cluster(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()