Skip to content

Commit d11c6f1

Browse files
committed
distinct behaviour on jenkins
1 parent ed64430 commit d11c6f1

File tree

1 file changed

+46
-21
lines changed

1 file changed

+46
-21
lines changed

test/integ/conftest.py

Lines changed: 46 additions & 21 deletions
Original file line numberDiff line numberDiff line change
@@ -15,6 +15,7 @@
1515
from snowflake.connector.compat import IS_WINDOWS
1616
from snowflake.connector.connection import DefaultConverterClass
1717

18+
from src.snowflake.connector.test_util import RUNNING_ON_JENKINS
1819
from .. import running_on_public_ci
1920
from ..parameters import CONNECTION_PARAMETERS
2021

@@ -28,6 +29,7 @@
2829
from snowflake.connector import SnowflakeConnection
2930

3031
RUNNING_ON_GH = os.getenv("GITHUB_ACTIONS") == "true"
32+
RUNNING_ON_JENKINS = os.getenv("JENKINS_HOME") is not None
3133
TEST_USING_VENDORED_ARROW = os.getenv("TEST_USING_VENDORED_ARROW") == "true"
3234

3335
if not isinstance(CONNECTION_PARAMETERS["host"], str):
@@ -72,17 +74,29 @@ def _get_worker_specific_schema():
7274
)
7375

7476

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+
}
86100

87101

88102
def print_help() -> None:
@@ -198,16 +212,27 @@ def init_test_schema(db_parameters) -> Generator[None]:
198212
199213
This is automatically called per test session.
200214
"""
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+
}
211236

212237
# Role may be needed when running on preprod, but is not present on Jenkins jobs
213238
optional_role = db_parameters.get("role")

0 commit comments

Comments
 (0)