From 195dba71f3a410aa612ac7566f446a8bc2b14a1c Mon Sep 17 00:00:00 2001 From: Mike Alfare Date: Thu, 22 Feb 2024 10:10:46 -0500 Subject: [PATCH 01/10] create expected test files --- .../functional/shared_tests/data/seed_model.sql | 16 ++++++++++++++++ tests/functional/shared_tests/data/seed_run.sql | 16 ++++++++++++++++ 2 files changed, 32 insertions(+) create mode 100644 tests/functional/shared_tests/data/seed_model.sql create mode 100644 tests/functional/shared_tests/data/seed_run.sql diff --git a/tests/functional/shared_tests/data/seed_model.sql b/tests/functional/shared_tests/data/seed_model.sql new file mode 100644 index 00000000..6727acb3 --- /dev/null +++ b/tests/functional/shared_tests/data/seed_model.sql @@ -0,0 +1,16 @@ +drop table if exists {schema}.on_model_hook; + +create table {schema}.on_model_hook ( + test_state TEXT, -- start|end + target_dbname TEXT, + target_host TEXT, + target_name TEXT, + target_schema TEXT, + target_type TEXT, + target_user TEXT, + target_pass TEXT, + target_threads INTEGER, + run_started_at TEXT, + invocation_id TEXT, + thread_id TEXT +); diff --git a/tests/functional/shared_tests/data/seed_run.sql b/tests/functional/shared_tests/data/seed_run.sql new file mode 100644 index 00000000..079ed34a --- /dev/null +++ b/tests/functional/shared_tests/data/seed_run.sql @@ -0,0 +1,16 @@ +drop table if exists {schema}.on_run_hook; + +create table {schema}.on_run_hook ( + test_state TEXT, -- start|end + target_dbname TEXT, + target_host TEXT, + target_name TEXT, + target_schema TEXT, + target_type TEXT, + target_user TEXT, + target_pass TEXT, + target_threads INTEGER, + run_started_at TEXT, + invocation_id TEXT, + thread_id TEXT +); From f88da8530fdbef35809ee1c057b3445579cc077a Mon Sep 17 00:00:00 2001 From: Mike Alfare Date: Thu, 22 Feb 2024 10:10:56 -0500 Subject: [PATCH 02/10] point to new base class --- tests/functional/shared_tests/test_column_types.py | 4 ++-- 1 file changed, 2 insertions(+), 2 deletions(-) diff --git a/tests/functional/shared_tests/test_column_types.py b/tests/functional/shared_tests/test_column_types.py index f5037860..47dec245 100644 --- a/tests/functional/shared_tests/test_column_types.py +++ b/tests/functional/shared_tests/test_column_types.py @@ -1,5 +1,5 @@ -from dbt.tests.adapter.column_types.test_column_types import BaseColumnTypes +from dbt.tests.adapter.column_types.test_column_types import BasePostgresColumnTypes -class TestPostgresColumnTypes(BaseColumnTypes): +class TestPostgresColumnTypes(BasePostgresColumnTypes): pass From 68c8e0759f650cff10dea8670fcc92e91b15b1d9 Mon Sep 17 00:00:00 2001 From: Mike Alfare Date: Thu, 22 Feb 2024 10:11:19 -0500 Subject: [PATCH 03/10] point to feature branch for testing, this should be reverted before merging --- pyproject.toml | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/pyproject.toml b/pyproject.toml index 6b58ab14..dfdde071 100644 --- a/pyproject.toml +++ b/pyproject.toml @@ -103,7 +103,7 @@ extra-dependencies = [ "dbt-adapters @ git+https://github.com/dbt-labs/dbt-adapters.git", "dbt-common @ git+https://github.com/dbt-labs/dbt-common.git", "dbt-core @ git+https://github.com/dbt-labs/dbt-core.git#subdirectory=core", - "dbt-tests-adapter @ git+https://github.com/dbt-labs/dbt-adapters.git#subdirectory=dbt-tests-adapter", + "dbt-tests-adapter @ git+https://github.com/dbt-labs/dbt-adapters.git@fix-testing-migration#subdirectory=dbt-tests-adapter", ] [tool.hatch.envs.integration-tests.env-vars] DBT_TEST_USER_1 = "dbt_test_user_1" From 30dc9779b902bce93ea5d8b14c99b260a79170da Mon Sep 17 00:00:00 2001 From: Mike Alfare Date: Thu, 22 Feb 2024 10:48:41 -0500 Subject: [PATCH 04/10] move files that use a `data` directory into their own directory to avoid collisions --- .../shared_tests/{ => test_hooks}/data/seed_model.sql | 0 .../shared_tests/{ => test_hooks}/data/seed_run.sql | 0 tests/functional/shared_tests/{ => test_hooks}/test_hooks.py | 4 ++++ .../shared_tests/{ => test_simple_seed}/test_simple_seed.py | 4 ++++ 4 files changed, 8 insertions(+) rename tests/functional/shared_tests/{ => test_hooks}/data/seed_model.sql (100%) rename tests/functional/shared_tests/{ => test_hooks}/data/seed_run.sql (100%) rename tests/functional/shared_tests/{ => test_hooks}/test_hooks.py (92%) rename tests/functional/shared_tests/{ => test_simple_seed}/test_simple_seed.py (89%) diff --git a/tests/functional/shared_tests/data/seed_model.sql b/tests/functional/shared_tests/test_hooks/data/seed_model.sql similarity index 100% rename from tests/functional/shared_tests/data/seed_model.sql rename to tests/functional/shared_tests/test_hooks/data/seed_model.sql diff --git a/tests/functional/shared_tests/data/seed_run.sql b/tests/functional/shared_tests/test_hooks/data/seed_run.sql similarity index 100% rename from tests/functional/shared_tests/data/seed_run.sql rename to tests/functional/shared_tests/test_hooks/data/seed_run.sql diff --git a/tests/functional/shared_tests/test_hooks.py b/tests/functional/shared_tests/test_hooks/test_hooks.py similarity index 92% rename from tests/functional/shared_tests/test_hooks.py rename to tests/functional/shared_tests/test_hooks/test_hooks.py index 3db138eb..84381130 100644 --- a/tests/functional/shared_tests/test_hooks.py +++ b/tests/functional/shared_tests/test_hooks/test_hooks.py @@ -1,3 +1,7 @@ +""" +This file needs to be in its own directory because it uses a `data` directory. +Placing this file in its own directory avoids collisions. +""" from dbt.tests.adapter.hooks.test_model_hooks import ( BasePrePostModelHooks, BaseHookRefs, diff --git a/tests/functional/shared_tests/test_simple_seed.py b/tests/functional/shared_tests/test_simple_seed/test_simple_seed.py similarity index 89% rename from tests/functional/shared_tests/test_simple_seed.py rename to tests/functional/shared_tests/test_simple_seed/test_simple_seed.py index 97b8870a..cd849788 100644 --- a/tests/functional/shared_tests/test_simple_seed.py +++ b/tests/functional/shared_tests/test_simple_seed/test_simple_seed.py @@ -1,3 +1,7 @@ +""" +This file needs to be in its own directory because it creates a `data` directory at run time. +Placing this file in its own directory avoids collisions. +""" from dbt.tests.adapter.simple_seed.test_seed import ( BaseBasicSeedTests, BaseSeedConfigFullRefreshOn, From f061e435b398865d61e1729f3662b92f4e716ffa Mon Sep 17 00:00:00 2001 From: Mike Alfare Date: Thu, 22 Feb 2024 12:14:13 -0500 Subject: [PATCH 05/10] move file to expected location --- tests/functional/shared_tests/{ => test_simple_seed}/seed_bom.csv | 0 1 file changed, 0 insertions(+), 0 deletions(-) rename tests/functional/shared_tests/{ => test_simple_seed}/seed_bom.csv (100%) diff --git a/tests/functional/shared_tests/seed_bom.csv b/tests/functional/shared_tests/test_simple_seed/seed_bom.csv similarity index 100% rename from tests/functional/shared_tests/seed_bom.csv rename to tests/functional/shared_tests/test_simple_seed/seed_bom.csv From a7902fd6965ceff3e9af104d70d5653230613f3a Mon Sep 17 00:00:00 2001 From: Mike Alfare Date: Thu, 22 Feb 2024 15:02:44 -0500 Subject: [PATCH 06/10] revert feature branch testing --- pyproject.toml | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/pyproject.toml b/pyproject.toml index dfdde071..6b58ab14 100644 --- a/pyproject.toml +++ b/pyproject.toml @@ -103,7 +103,7 @@ extra-dependencies = [ "dbt-adapters @ git+https://github.com/dbt-labs/dbt-adapters.git", "dbt-common @ git+https://github.com/dbt-labs/dbt-common.git", "dbt-core @ git+https://github.com/dbt-labs/dbt-core.git#subdirectory=core", - "dbt-tests-adapter @ git+https://github.com/dbt-labs/dbt-adapters.git@fix-testing-migration#subdirectory=dbt-tests-adapter", + "dbt-tests-adapter @ git+https://github.com/dbt-labs/dbt-adapters.git#subdirectory=dbt-tests-adapter", ] [tool.hatch.envs.integration-tests.env-vars] DBT_TEST_USER_1 = "dbt_test_user_1" From ef5d4f117b40c6928f0e5ac445bbe82fe0af72b4 Mon Sep 17 00:00:00 2001 From: Mike Alfare Date: Tue, 27 Feb 2024 17:37:19 -0500 Subject: [PATCH 07/10] update dependencies for 1.0.0b1 --- pyproject.toml | 4 ++-- 1 file changed, 2 insertions(+), 2 deletions(-) diff --git a/pyproject.toml b/pyproject.toml index 6b67b91a..2908487b 100644 --- a/pyproject.toml +++ b/pyproject.toml @@ -23,10 +23,10 @@ classifiers = [ "Programming Language :: Python :: 3.11", ] dependencies = [ - "dbt-adapters>=0.1.0a6,<0.2.0", + "dbt-adapters>=1.0.0b1,<2.0", "psycopg2>=2.9,<3.0", # installed via dbt-adapters but used directly - "dbt-common<2.0", + "dbt-common>=1.0.0b1,<2.0", "agate>=1.0,<2.0", ] [project.urls] From f02a22cbb97066724e69b344fa9c20af880f4e26 Mon Sep 17 00:00:00 2001 From: Mike Alfare Date: Tue, 27 Feb 2024 17:41:46 -0500 Subject: [PATCH 08/10] update dependencies for 1.0.0b1 --- pyproject.toml | 4 ++-- 1 file changed, 2 insertions(+), 2 deletions(-) diff --git a/pyproject.toml b/pyproject.toml index 2908487b..ea22820f 100644 --- a/pyproject.toml +++ b/pyproject.toml @@ -23,10 +23,10 @@ classifiers = [ "Programming Language :: Python :: 3.11", ] dependencies = [ - "dbt-adapters>=1.0.0b1,<2.0", + "dbt-adapters<2.0", "psycopg2>=2.9,<3.0", # installed via dbt-adapters but used directly - "dbt-common>=1.0.0b1,<2.0", + "dbt-common<2.0", "agate>=1.0,<2.0", ] [project.urls] From b62d222d7a77289a6afc08884d5e02ecfb8aad47 Mon Sep 17 00:00:00 2001 From: Mike Alfare Date: Tue, 27 Feb 2024 17:44:02 -0500 Subject: [PATCH 09/10] update dependencies for 1.0.0b1 --- pyproject.toml | 4 ++-- 1 file changed, 2 insertions(+), 2 deletions(-) diff --git a/pyproject.toml b/pyproject.toml index ea22820f..136695c0 100644 --- a/pyproject.toml +++ b/pyproject.toml @@ -23,10 +23,10 @@ classifiers = [ "Programming Language :: Python :: 3.11", ] dependencies = [ - "dbt-adapters<2.0", + "dbt-adapters<2.0.0a1", "psycopg2>=2.9,<3.0", # installed via dbt-adapters but used directly - "dbt-common<2.0", + "dbt-common<2.0.0a1", "agate>=1.0,<2.0", ] [project.urls] From 55d0fca9b11992aac8090c1f7eac53543d2697d1 Mon Sep 17 00:00:00 2001 From: Mike Alfare Date: Tue, 27 Feb 2024 17:58:57 -0500 Subject: [PATCH 10/10] update dependencies for 1.0.0b1 --- pyproject.toml | 4 ++-- 1 file changed, 2 insertions(+), 2 deletions(-) diff --git a/pyproject.toml b/pyproject.toml index 136695c0..acef4e33 100644 --- a/pyproject.toml +++ b/pyproject.toml @@ -23,10 +23,10 @@ classifiers = [ "Programming Language :: Python :: 3.11", ] dependencies = [ - "dbt-adapters<2.0.0a1", + "dbt-adapters>=0.1.0a1,<2.0", "psycopg2>=2.9,<3.0", # installed via dbt-adapters but used directly - "dbt-common<2.0.0a1", + "dbt-common>=0.1.0a1,<2.0", "agate>=1.0,<2.0", ] [project.urls]