From ea6e5e1d7e63d111cd943f415360340f0f884a77 Mon Sep 17 00:00:00 2001 From: Mike Alfare Date: Thu, 21 Sep 2023 17:55:39 -0400 Subject: [PATCH 1/6] implement tests for persist test results as view --- .changes/unreleased/Features-20230921-175106.yaml | 6 ++++++ Makefile | 1 + dev-requirements.txt | 4 ++-- tests/functional/adapter/test_persist_test_results.py | 5 +++++ 4 files changed, 14 insertions(+), 2 deletions(-) create mode 100644 .changes/unreleased/Features-20230921-175106.yaml create mode 100644 tests/functional/adapter/test_persist_test_results.py diff --git a/.changes/unreleased/Features-20230921-175106.yaml b/.changes/unreleased/Features-20230921-175106.yaml new file mode 100644 index 000000000..0122f4af0 --- /dev/null +++ b/.changes/unreleased/Features-20230921-175106.yaml @@ -0,0 +1,6 @@ +kind: Features +body: Support persisting test results as a view +time: 2023-09-21T17:51:06.389529-04:00 +custom: + Author: mikealfare + Issue: "6914" diff --git a/Makefile b/Makefile index c75b0c6a9..fc6536f98 100644 --- a/Makefile +++ b/Makefile @@ -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-bigquery .PHONY: ubuntu-py311 ubuntu-py311: ## Builds and runs an Ubuntu Python 3.11 development container diff --git a/dev-requirements.txt b/dev-requirements.txt index 54ca40f26..0de27b55f 100644 --- a/dev-requirements.txt +++ b/dev-requirements.txt @@ -1,7 +1,7 @@ # install latest changes in dbt-core # TODO: how to automate switching from develop to version branches? -git+https://github.com/dbt-labs/dbt-core.git#egg=dbt-core&subdirectory=core -git+https://github.com/dbt-labs/dbt-core.git#egg=dbt-tests-adapter&subdirectory=tests/adapter +git+https://github.com/dbt-labs/dbt-core.git@feature/materialized-tests/adap-850#egg=dbt-core&subdirectory=core +git+https://github.com/dbt-labs/dbt-core.git@feature/materialized-tests/adap-850#egg=dbt-tests-adapter&subdirectory=tests/adapter # if version 1.x or greater -> pin to major version # if version 0.x -> pin to minor diff --git a/tests/functional/adapter/test_persist_test_results.py b/tests/functional/adapter/test_persist_test_results.py new file mode 100644 index 000000000..75bfb5acc --- /dev/null +++ b/tests/functional/adapter/test_persist_test_results.py @@ -0,0 +1,5 @@ +from dbt.tests.adapter.persist_test_results.basic import PersistTestResults + + +class TestPersistTestResults(PersistTestResults): + pass From 6b7f78acc2895bc546e4a0dc5e72c69dd37ee8c8 Mon Sep 17 00:00:00 2001 From: Mike Alfare Date: Thu, 28 Sep 2023 22:24:24 -0400 Subject: [PATCH 2/6] update changelog entry to reflect renamed parameter --- .changes/unreleased/Features-20230921-175106.yaml | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/.changes/unreleased/Features-20230921-175106.yaml b/.changes/unreleased/Features-20230921-175106.yaml index 0122f4af0..cd833de67 100644 --- a/.changes/unreleased/Features-20230921-175106.yaml +++ b/.changes/unreleased/Features-20230921-175106.yaml @@ -1,5 +1,5 @@ kind: Features -body: Support persisting test results as a view +body: Support storing test failures as views time: 2023-09-21T17:51:06.389529-04:00 custom: Author: mikealfare From 5e6c4e131091d8cee479fc226c7ae3edeffdece0 Mon Sep 17 00:00:00 2001 From: Mike Alfare Date: Thu, 28 Sep 2023 22:27:45 -0400 Subject: [PATCH 3/6] update test names to reflect renamed parameter --- .../store_test_failures_tests/test_store_test_failures.py | 6 ++++++ tests/functional/adapter/test_persist_test_results.py | 5 ----- 2 files changed, 6 insertions(+), 5 deletions(-) delete mode 100644 tests/functional/adapter/test_persist_test_results.py diff --git a/tests/functional/adapter/store_test_failures_tests/test_store_test_failures.py b/tests/functional/adapter/store_test_failures_tests/test_store_test_failures.py index d22dab3ae..2b9e3c148 100644 --- a/tests/functional/adapter/store_test_failures_tests/test_store_test_failures.py +++ b/tests/functional/adapter/store_test_failures_tests/test_store_test_failures.py @@ -1,4 +1,6 @@ import pytest + +from dbt.tests.adapter.store_test_failures_tests.basic import StoreTestFailures from dbt.tests.adapter.store_test_failures_tests.test_store_test_failures import ( StoreTestFailuresBase, ) @@ -20,3 +22,7 @@ def teardown_method(self, project): def test_store_and_assert(self, project): self.run_tests_store_one_failure(project) self.run_tests_store_failures_and_assert(project) + + +class TestStoreTestFailures(StoreTestFailures): + pass diff --git a/tests/functional/adapter/test_persist_test_results.py b/tests/functional/adapter/test_persist_test_results.py deleted file mode 100644 index 75bfb5acc..000000000 --- a/tests/functional/adapter/test_persist_test_results.py +++ /dev/null @@ -1,5 +0,0 @@ -from dbt.tests.adapter.persist_test_results.basic import PersistTestResults - - -class TestPersistTestResults(PersistTestResults): - pass From c42aabd80db578f5d11ce270fcc0cdf4025850ea Mon Sep 17 00:00:00 2001 From: Mike Alfare Date: Tue, 3 Oct 2023 16:40:46 -0400 Subject: [PATCH 4/6] implement store-failures-as tests --- .../test_store_test_failures.py | 21 +++++++++++++++++-- 1 file changed, 19 insertions(+), 2 deletions(-) diff --git a/tests/functional/adapter/store_test_failures_tests/test_store_test_failures.py b/tests/functional/adapter/store_test_failures_tests/test_store_test_failures.py index 2b9e3c148..d14688f77 100644 --- a/tests/functional/adapter/store_test_failures_tests/test_store_test_failures.py +++ b/tests/functional/adapter/store_test_failures_tests/test_store_test_failures.py @@ -1,6 +1,11 @@ import pytest -from dbt.tests.adapter.store_test_failures_tests.basic import StoreTestFailures +from dbt.tests.adapter.store_test_failures_tests.basic import ( + StoreTestFailuresAsGeneric, + StoreTestFailuresAsInteractions, + StoreTestFailuresAsProjectLevelOff, + StoreTestFailuresAsProjectLevelView, +) from dbt.tests.adapter.store_test_failures_tests.test_store_test_failures import ( StoreTestFailuresBase, ) @@ -24,5 +29,17 @@ def test_store_and_assert(self, project): self.run_tests_store_failures_and_assert(project) -class TestStoreTestFailures(StoreTestFailures): +class TestBigQueryStoreTestFailuresAsInteractions(StoreTestFailuresAsInteractions): + pass + + +class TestBigQueryStoreTestFailuresAsProjectLevelOff(StoreTestFailuresAsProjectLevelOff): + pass + + +class TestBigQueryStoreTestFailuresAsProjectLevelView(StoreTestFailuresAsProjectLevelView): + pass + + +class TestBigQueryStoreTestFailuresAsGeneric(StoreTestFailuresAsGeneric): pass From 0eb12ab6b8a288d26738172da43d73c0af4c6eec Mon Sep 17 00:00:00 2001 From: Mike Alfare Date: Tue, 10 Oct 2023 18:03:23 -0400 Subject: [PATCH 5/6] revert dev requirements to point back to main on dbt-core --- dev-requirements.txt | 4 ++-- 1 file changed, 2 insertions(+), 2 deletions(-) diff --git a/dev-requirements.txt b/dev-requirements.txt index 89e9c01a8..496aa5538 100644 --- a/dev-requirements.txt +++ b/dev-requirements.txt @@ -1,7 +1,7 @@ # install latest changes in dbt-core # TODO: how to automate switching from develop to version branches? -git+https://github.com/dbt-labs/dbt-core.git@feature/materialized-tests/adap-850#egg=dbt-core&subdirectory=core -git+https://github.com/dbt-labs/dbt-core.git@feature/materialized-tests/adap-850#egg=dbt-tests-adapter&subdirectory=tests/adapter +git+https://github.com/dbt-labs/dbt-core.git#egg=dbt-core&subdirectory=core +git+https://github.com/dbt-labs/dbt-core.git#egg=dbt-tests-adapter&subdirectory=tests/adapter # if version 1.x or greater -> pin to major version # if version 0.x -> pin to minor From ccf856f7b2aa8c91f614a9f230dafc60eecb75b5 Mon Sep 17 00:00:00 2001 From: Mike Alfare Date: Tue, 10 Oct 2023 18:13:24 -0400 Subject: [PATCH 6/6] update tests to include recent tests from dbt-core --- .../test_store_test_failures.py | 23 +++++++++++-------- 1 file changed, 13 insertions(+), 10 deletions(-) diff --git a/tests/functional/adapter/store_test_failures_tests/test_store_test_failures.py b/tests/functional/adapter/store_test_failures_tests/test_store_test_failures.py index d14688f77..b9de2b80b 100644 --- a/tests/functional/adapter/store_test_failures_tests/test_store_test_failures.py +++ b/tests/functional/adapter/store_test_failures_tests/test_store_test_failures.py @@ -1,11 +1,6 @@ import pytest -from dbt.tests.adapter.store_test_failures_tests.basic import ( - StoreTestFailuresAsGeneric, - StoreTestFailuresAsInteractions, - StoreTestFailuresAsProjectLevelOff, - StoreTestFailuresAsProjectLevelView, -) +from dbt.tests.adapter.store_test_failures_tests import basic from dbt.tests.adapter.store_test_failures_tests.test_store_test_failures import ( StoreTestFailuresBase, ) @@ -29,17 +24,25 @@ def test_store_and_assert(self, project): self.run_tests_store_failures_and_assert(project) -class TestBigQueryStoreTestFailuresAsInteractions(StoreTestFailuresAsInteractions): +class TestStoreTestFailuresAsInteractions(basic.StoreTestFailuresAsInteractions): + pass + + +class TestStoreTestFailuresAsProjectLevelOff(basic.StoreTestFailuresAsProjectLevelOff): + pass + + +class TestStoreTestFailuresAsProjectLevelView(basic.StoreTestFailuresAsProjectLevelView): pass -class TestBigQueryStoreTestFailuresAsProjectLevelOff(StoreTestFailuresAsProjectLevelOff): +class TestStoreTestFailuresAsGeneric(basic.StoreTestFailuresAsGeneric): pass -class TestBigQueryStoreTestFailuresAsProjectLevelView(StoreTestFailuresAsProjectLevelView): +class TestStoreTestFailuresAsProjectLevelEphemeral(basic.StoreTestFailuresAsProjectLevelEphemeral): pass -class TestBigQueryStoreTestFailuresAsGeneric(StoreTestFailuresAsGeneric): +class TestStoreTestFailuresAsExceptions(basic.StoreTestFailuresAsExceptions): pass