Skip to content

Commit f1763a8

Browse files
committed
Fix profile tests
1 parent cce8950 commit f1763a8

3 files changed

Lines changed: 85 additions & 22 deletions

File tree

.github/scripts/profiles.yml

Lines changed: 14 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -28,7 +28,7 @@ test_sw_up_options:
2828
use_ssl: false
2929
user: dremio
3030
target: dev
31-
test_enterprise_catalog_options:
31+
test_sw_enterprise_catalog_pat_options:
3232
outputs:
3333
dev:
3434
enterprise_catalog_namespace: test_catalog
@@ -41,3 +41,16 @@ test_enterprise_catalog_options:
4141
use_ssl: false
4242
user: dremio
4343
target: dev
44+
test_sw_enterprise_catalog_up_options:
45+
outputs:
46+
dev:
47+
enterprise_catalog_namespace: test_catalog
48+
enterprise_catalog_folder: no_schema
49+
password: dremio123
50+
port: 9047
51+
software_host: localhost
52+
threads: 1
53+
type: dremio
54+
use_ssl: false
55+
user: dremio
56+
target: dev

tests/component/test_profile_template.py

Lines changed: 62 additions & 16 deletions
Original file line numberDiff line numberDiff line change
@@ -23,7 +23,7 @@
2323

2424
# Tests require manual setup before executing.
2525
#
26-
# Prior to running these tests, create four dbt projects:
26+
# Prior to running these tests, create six dbt projects:
2727
#
2828
# 1. `dbt init test_cloud_options`
2929
# - accept all default options
@@ -37,13 +37,27 @@
3737
# - accept all default options
3838
# - provide any value for mandatory options
3939
#
40-
# 4. `dbt init test_enterprise_catalog_options`
40+
# 4. `dbt init test_sw_enterprise_catalog_pat_options`
41+
# - select software_with_pat
4142
# - select enterprise catalog storage option
43+
# - select PAT authentication
4244
# - accept all default options
4345
# - provide any value for mandatory options
4446
#
47+
# 5. `dbt init test_sw_enterprise_catalog_up_options`
48+
# - select software_with_username_password
49+
# - select enterprise catalog storage option
50+
# - select username/password authentication
51+
# - accept all default options
52+
# - provide any value for mandatory options
53+
#
54+
# 6. `dbt init test_cloud_enterprise_catalog_options`
55+
# - select cloud
56+
# - select enterprise catalog storage option
57+
# - accept all default options
58+
# - provide any value for mandatory options
4559
# These tests assumes there exists a $HOME/.dbt/profiles.yml
46-
# file containing these four dbt projects.
60+
# file containing these six dbt projects.
4761

4862

4963
class TestProfileTemplate:
@@ -58,7 +72,9 @@ class TestProfileTemplate:
5872
"test_sw_up_options" # nosec hardcoded_password_string
5973
)
6074
_TEST_SOFTWARE_PAT_PROFILE_PROJECT = "test_sw_pat_options"
61-
_TEST_ENTERPRISE_CATALOG_PROFILE_PROJECT = "test_enterprise_catalog_options"
75+
_TEST_SW_ENTERPRISE_CATALOG_PAT_PROFILE_PROJECT = "test_sw_enterprise_catalog_pat_options"
76+
_TEST_SW_ENTERPRISE_CATALOG_USER_PASSWORD_PROFILE_PROJECT = "test_sw_enterprise_catalog_up_options"
77+
_TEST_CLOUD_ENTERPRISE_CATALOG_PROFILE_PROJECT = "test_cloud_enterprise_catalog_options"
6278

6379
_PASSWORD_AUTH_PROFILE_OPTIONS_WITH_DEFAULTS = {"password": None}
6480
_PAT_AUTH_PROFILE_OPTIONS_WITH_DEFAULTS = {"pat": None}
@@ -79,13 +95,18 @@ class TestProfileTemplate:
7995
"port": 9047,
8096
"use_ssl": False,
8197
}
82-
_ENTERPRISE_CATALOG_PROFILE_SPECIFIC_OPTIONS_WITH_DEFAULTS = {
98+
_DREMIO_SW_ENTERPRISE_CATALOG_PROFILE_SPECIFIC_OPTIONS_WITH_DEFAULTS = {
8399
"enterprise_catalog_namespace": None,
84100
"enterprise_catalog_folder": None,
85101
"software_host": None,
86102
"port": 9047,
87103
"use_ssl": False,
88104
}
105+
_DREMIO_CLOUD_ENTERPRISE_CATALOG_PROFILE_SPECIFIC_OPTIONS_WITH_DEFAULTS = {
106+
"enterprise_catalog_namespace": None,
107+
"enterprise_catalog_folder": None,
108+
"use_ssl": False,
109+
}
89110

90111
_DREMIO_CLOUD_PROFILE_OPTIONS_WITH_DEFAULTS = (
91112
_COMMON_PROFILE_OPTIONS_WITH_DEFAULTS
@@ -102,14 +123,19 @@ class TestProfileTemplate:
102123
| _DREMIO_SW_PROFILE_SPECIFIC_OPTIONS_WITH_DEFAULTS
103124
| _PAT_AUTH_PROFILE_OPTIONS_WITH_DEFAULTS
104125
)
105-
_DREMIO_ENTERPRISE_CATALOG_USERNAME_PASSWORD_PROFILE_OPTIONS = (
126+
_DREMIO_SW_ENTERPRISE_CATALOG_USERNAME_PASSWORD_PROFILE_OPTIONS = (
106127
_COMMON_PROFILE_OPTIONS_WITH_DEFAULTS
107-
| _ENTERPRISE_CATALOG_PROFILE_SPECIFIC_OPTIONS_WITH_DEFAULTS
128+
| _DREMIO_SW_ENTERPRISE_CATALOG_PROFILE_SPECIFIC_OPTIONS_WITH_DEFAULTS
108129
| _PASSWORD_AUTH_PROFILE_OPTIONS_WITH_DEFAULTS
109130
)
110-
_DREMIO_ENTERPRISE_CATALOG_PAT_PROFILE_OPTIONS = (
131+
_DREMIO_SW_ENTERPRISE_CATALOG_PAT_PROFILE_OPTIONS = (
132+
_COMMON_PROFILE_OPTIONS_WITH_DEFAULTS
133+
| _DREMIO_SW_ENTERPRISE_CATALOG_PROFILE_SPECIFIC_OPTIONS_WITH_DEFAULTS
134+
| _PAT_AUTH_PROFILE_OPTIONS_WITH_DEFAULTS
135+
)
136+
_DREMIO_CLOUD_ENTERPRISE_CATALOG_PROFILE_OPTIONS_WITH_DEFAULTS = (
111137
_COMMON_PROFILE_OPTIONS_WITH_DEFAULTS
112-
| _ENTERPRISE_CATALOG_PROFILE_SPECIFIC_OPTIONS_WITH_DEFAULTS
138+
| _DREMIO_CLOUD_ENTERPRISE_CATALOG_PROFILE_SPECIFIC_OPTIONS_WITH_DEFAULTS
113139
| _PAT_AUTH_PROFILE_OPTIONS_WITH_DEFAULTS
114140
)
115141

@@ -124,8 +150,8 @@ class TestProfileTemplate:
124150
}
125151

126152
@pytest.mark.skipif(
127-
DREMIO_EDITION == "community",
128-
reason="Cloud options are not available in Dremio community edition.",
153+
DREMIO_EDITION != "cloud",
154+
reason="Cloud options are not available in Dremio community/enterprise edition.",
129155
)
130156
def test_cloud_options(self) -> None:
131157
self._test_project_profile_options(
@@ -156,13 +182,33 @@ def test_aliases(self) -> None:
156182

157183

158184
@pytest.mark.skipif(
159-
DREMIO_EDITION == "community",
160-
reason="Enterprise catalog options are not available in Dremio community edition.",
185+
DREMIO_EDITION != "enterprise",
186+
reason="Dremio Software enterprise catalog options are specific to Dremio Enterprise edition.",
187+
)
188+
def test_sw_enterprise_catalog_username_password_options(self) -> None:
189+
self._test_project_profile_options(
190+
self._get_dbt_test_project_dict(self._TEST_SW_ENTERPRISE_CATALOG_USER_PASSWORD_PROFILE_PROJECT),
191+
self._DREMIO_SW_ENTERPRISE_CATALOG_USERNAME_PASSWORD_PROFILE_OPTIONS,
192+
)
193+
194+
@pytest.mark.skipif(
195+
DREMIO_EDITION != "enterprise",
196+
reason="Dremio Software enterprise catalog options are specific to Dremio Enterprise edition.",
197+
)
198+
def test_sw_enterprise_catalog_pat_options(self) -> None:
199+
self._test_project_profile_options(
200+
self._get_dbt_test_project_dict(self._TEST_SW_ENTERPRISE_CATALOG_PAT_PROFILE_PROJECT),
201+
self._DREMIO_SW_ENTERPRISE_CATALOG_PAT_PROFILE_OPTIONS,
202+
)
203+
204+
@pytest.mark.skipif(
205+
DREMIO_EDITION != "cloud",
206+
reason="Dremio Software enterprise catalog options are specific to Dremio Enterprise edition.",
161207
)
162-
def test_enterprise_catalog_options(self) -> None:
208+
def test_cloud_enterprise_catalog_options(self) -> None:
163209
self._test_project_profile_options(
164-
self._get_dbt_test_project_dict(self._TEST_ENTERPRISE_CATALOG_PROFILE_PROJECT),
165-
self._DREMIO_ENTERPRISE_CATALOG_PROFILE_OPTIONS,
210+
self._get_dbt_test_project_dict(self._TEST_CLOUD_ENTERPRISE_CATALOG_PROFILE_PROJECT),
211+
self._DREMIO_CLOUD_ENTERPRISE_CATALOG_PROFILE_OPTIONS_WITH_DEFAULTS,
166212
)
167213

168214
@pytest.mark.skip

tests/functional/adapter/dremio_specific/test_twin_strategy.py

Lines changed: 9 additions & 5 deletions
Original file line numberDiff line numberDiff line change
@@ -6,7 +6,8 @@
66
from tests.utils.util import (
77
check_relation_types,
88
relation_from_name,
9-
get_connection
9+
get_connection,
10+
BUCKET
1011
)
1112

1213
DREMIO_EDITION = os.getenv("DREMIO_EDITION")
@@ -237,12 +238,15 @@ def test_overwrite_table(self, project):
237238
assert columns_table[0].name == "table_column"
238239

239240
class TestTwinStrategyNotAppliedDremio:
240-
# Override unique_schema to be the schema defined in Jenkins tests
241+
# Override unique_schema to be the schema defined in Jenkins tests, i.e., tests_functional_adapter_dremio_specific
241242
@pytest.fixture(scope="class")
242243
def unique_schema(self, request, prefix) -> str:
243-
test_file = request.module.__name__
244-
# We want everything besides the last part of the name (i.e. tests.functional.adapter.dremio_specific)
245-
test_file = "_".join(test_file.split(".")[:-1])
244+
test_file_path = request.module.__file__
245+
relative_path = os.path.relpath(test_file_path, os.getcwd())
246+
# Get directory path and remove filename
247+
dir_path = os.path.dirname(relative_path)
248+
# Replace '/' with '_' to create schema name
249+
test_file = dir_path.replace('/', '_')
246250
unique_schema = test_file
247251
return unique_schema
248252

0 commit comments

Comments
 (0)