|
15 | 15 | from snowflake.connector.compat import IS_WINDOWS |
16 | 16 | from snowflake.connector.connection import DefaultConverterClass |
17 | 17 |
|
| 18 | +from src.snowflake.connector.test_util import RUNNING_ON_JENKINS |
18 | 19 | from .. import running_on_public_ci |
19 | 20 | from ..parameters import CONNECTION_PARAMETERS |
20 | 21 |
|
|
28 | 29 | from snowflake.connector import SnowflakeConnection |
29 | 30 |
|
30 | 31 | RUNNING_ON_GH = os.getenv("GITHUB_ACTIONS") == "true" |
| 32 | +RUNNING_ON_JENKINS = os.getenv("JENKINS_HOME") is not None |
31 | 33 | TEST_USING_VENDORED_ARROW = os.getenv("TEST_USING_VENDORED_ARROW") == "true" |
32 | 34 |
|
33 | 35 | if not isinstance(CONNECTION_PARAMETERS["host"], str): |
@@ -72,17 +74,29 @@ def _get_worker_specific_schema(): |
72 | 74 | ) |
73 | 75 |
|
74 | 76 |
|
75 | | -DEFAULT_PARAMETERS: dict[str, Any] = { |
76 | | - "account": "<account_name>", |
77 | | - "user": "<user_name>", |
78 | | - "database": "<database_name>", |
79 | | - "schema": "<schema_name>", |
80 | | - "protocol": "https", |
81 | | - "host": "<host>", |
82 | | - "port": "443", |
83 | | - "authenticator": "<authenticator>", |
84 | | - "private_key_file": "<private_key_file>", |
85 | | -} |
| 77 | +if RUNNING_ON_JENKINS: |
| 78 | + DEFAULT_PARAMETERS: dict[str, Any] = { |
| 79 | + "account": "<account_name>", |
| 80 | + "user": "<user_name>", |
| 81 | + "password": "<password>", |
| 82 | + "database": "<database_name>", |
| 83 | + "schema": "<schema_name>", |
| 84 | + "protocol": "https", |
| 85 | + "host": "<host>", |
| 86 | + "port": "443", |
| 87 | + } |
| 88 | +else: |
| 89 | + DEFAULT_PARAMETERS: dict[str, Any] = { |
| 90 | + "account": "<account_name>", |
| 91 | + "user": "<user_name>", |
| 92 | + "database": "<database_name>", |
| 93 | + "schema": "<schema_name>", |
| 94 | + "protocol": "https", |
| 95 | + "host": "<host>", |
| 96 | + "port": "443", |
| 97 | + "authenticator": "<authenticator>", |
| 98 | + "private_key_file": "<private_key_file>" |
| 99 | + } |
86 | 100 |
|
87 | 101 |
|
88 | 102 | def print_help() -> None: |
@@ -198,16 +212,27 @@ def init_test_schema(db_parameters) -> Generator[None]: |
198 | 212 |
|
199 | 213 | This is automatically called per test session. |
200 | 214 | """ |
201 | | - connection_params = { |
202 | | - "user": db_parameters["user"], |
203 | | - "host": db_parameters["host"], |
204 | | - "port": db_parameters["port"], |
205 | | - "database": db_parameters["database"], |
206 | | - "account": db_parameters["account"], |
207 | | - "protocol": db_parameters["protocol"], |
208 | | - "authenticator": db_parameters["authenticator"], |
209 | | - "private_key_file": db_parameters["private_key_file"], |
210 | | - } |
| 215 | + if RUNNING_ON_GH: |
| 216 | + connection_params = { |
| 217 | + "user": db_parameters["user"], |
| 218 | + "host": db_parameters["host"], |
| 219 | + "port": db_parameters["port"], |
| 220 | + "database": db_parameters["database"], |
| 221 | + "account": db_parameters["account"], |
| 222 | + "protocol": db_parameters["protocol"], |
| 223 | + "authenticator": db_parameters["authenticator"], |
| 224 | + "private_key_file": db_parameters["private_key_file"], |
| 225 | + } |
| 226 | + else: |
| 227 | + connection_params = { |
| 228 | + "user": db_parameters["user"], |
| 229 | + "password": db_parameters["password"], |
| 230 | + "host": db_parameters["host"], |
| 231 | + "port": db_parameters["port"], |
| 232 | + "database": db_parameters["database"], |
| 233 | + "account": db_parameters["account"], |
| 234 | + "protocol": db_parameters["protocol"], |
| 235 | + } |
211 | 236 |
|
212 | 237 | # Role may be needed when running on preprod, but is not present on Jenkins jobs |
213 | 238 | optional_role = db_parameters.get("role") |
|
0 commit comments