Skip to content

Commit

Permalink
ADAP-894: Support test results as views (#889)
Browse files Browse the repository at this point in the history
* implement tests for persist test results functionality

* updated project config for tests

* revert config changes

* skip Spark, which needs different delete sql

* add Spark config

* add a skip marker indicating the issue that needs to be resolved

* pull the test case in from core to show that everything passes except for the deletion step

* update changelog and test names to reflect renamed parameter

* correct fixture names in test

* updated the name of the overridden test so that it actually overrides the test

* update the row count method so support spark requirements

* added --store-failures parameter to the dbt invocation

* implement store-failures-as tests

* skip spark-session from store-failures-as tests

* revert dev requirements to point back to main on dbt-core

* revert dev requirements to point back to main on dbt-core

* update signature of get_catalog to match dbt-core and appease mypy
  • Loading branch information
mikealfare authored Oct 11, 2023
1 parent 992de28 commit 04d01af
Show file tree
Hide file tree
Showing 4 changed files with 41 additions and 1 deletion.
6 changes: 6 additions & 0 deletions .changes/unreleased/Features-20230921-180958.yaml
Original file line number Diff line number Diff line change
@@ -0,0 +1,6 @@
kind: Features
body: Support storing test failures as views
time: 2023-09-21T18:09:58.174136-04:00
custom:
Author: mikealfare
Issue: "6914"
1 change: 1 addition & 0 deletions Makefile
Original file line number Diff line number Diff line change
Expand Up @@ -9,6 +9,7 @@ dev: ## Installs adapter in develop mode along with development dependencies
dev-uninstall: ## Uninstalls all packages while maintaining the virtual environment
## Useful when updating versions, or if you accidentally installed into the system interpreter
pip freeze | grep -v "^-e" | cut -d "@" -f1 | xargs pip uninstall -y
pip uninstall -y dbt-spark

.PHONY: mypy
mypy: ## Runs mypy against staged changes for static type checking.
Expand Down
4 changes: 3 additions & 1 deletion dbt/adapters/spark/impl.py
Original file line number Diff line number Diff line change
Expand Up @@ -347,7 +347,9 @@ def _get_columns_for_catalog(self, relation: BaseRelation) -> Iterable[Dict[str,
as_dict["table_database"] = None
yield as_dict

def get_catalog(self, manifest: Manifest) -> Tuple[agate.Table, List[Exception]]:
def get_catalog(
self, manifest: Manifest, selected_nodes: Optional[Set] = None
) -> Tuple[agate.Table, List[Exception]]:
schema_map = self._get_catalog_schemas(manifest)
if len(schema_map) > 1:
raise dbt.exceptions.CompilationError(
Expand Down
Original file line number Diff line number Diff line change
@@ -1,5 +1,6 @@
import pytest

from dbt.tests.adapter.store_test_failures_tests import basic
from dbt.tests.adapter.store_test_failures_tests.test_store_test_failures import (
StoreTestFailuresBase,
TEST_AUDIT_SCHEMA_SUFFIX,
Expand Down Expand Up @@ -42,3 +43,33 @@ def project_config_update(self):
def test_store_and_assert_failure_with_delta(self, project):
self.run_tests_store_one_failure(project)
self.run_tests_store_failures_and_assert(project)


@pytest.mark.skip_profile("spark_session")
class TestStoreTestFailuresAsInteractions(basic.StoreTestFailuresAsInteractions):
pass


@pytest.mark.skip_profile("spark_session")
class TestStoreTestFailuresAsProjectLevelOff(basic.StoreTestFailuresAsProjectLevelOff):
pass


@pytest.mark.skip_profile("spark_session")
class TestStoreTestFailuresAsProjectLevelView(basic.StoreTestFailuresAsProjectLevelView):
pass


@pytest.mark.skip_profile("spark_session")
class TestStoreTestFailuresAsGeneric(basic.StoreTestFailuresAsGeneric):
pass


@pytest.mark.skip_profile("spark_session")
class TestStoreTestFailuresAsProjectLevelEphemeral(basic.StoreTestFailuresAsProjectLevelEphemeral):
pass


@pytest.mark.skip_profile("spark_session")
class TestStoreTestFailuresAsExceptions(basic.StoreTestFailuresAsExceptions):
pass

0 comments on commit 04d01af

Please sign in to comment.