Skip to content

Commit 456cb39

Browse files
NO-SNOW add flag for local test setup (#2397)
1 parent a51bec4 commit 456cb39

File tree

2 files changed

+20
-19
lines changed

2 files changed

+20
-19
lines changed

test/integ/conftest.py

Lines changed: 5 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -91,6 +91,11 @@ def is_public_testaccount() -> bool:
9191
return running_on_public_ci() or db_parameters["account"].startswith("sfctest0")
9292

9393

94+
@pytest.fixture(scope="session")
95+
def is_local_dev_setup(db_parameters) -> bool:
96+
return db_parameters.get("is_local_dev_setup", False)
97+
98+
9499
@pytest.fixture(scope="session")
95100
def db_parameters() -> dict[str, str]:
96101
return get_db_parameters()

test/integ/test_connection.py

Lines changed: 15 additions & 19 deletions
Original file line numberDiff line numberDiff line change
@@ -1386,7 +1386,9 @@ def test_server_session_keep_alive(conn_cnx):
13861386

13871387

13881388
@pytest.mark.skipolddriver
1389-
def test_ocsp_mode_disable_ocsp_checks(conn_cnx, is_public_test, caplog):
1389+
def test_ocsp_mode_disable_ocsp_checks(
1390+
conn_cnx, is_public_test, is_local_dev_setup, caplog
1391+
):
13901392
caplog.set_level(logging.DEBUG, "snowflake.connector.ocsp_snowflake")
13911393
with conn_cnx(disable_ocsp_checks=True) as conn, conn.cursor() as cur:
13921394
assert cur.execute("select 1").fetchall() == [(1,)]
@@ -1395,75 +1397,69 @@ def test_ocsp_mode_disable_ocsp_checks(conn_cnx, is_public_test, caplog):
13951397

13961398
with conn_cnx() as conn, conn.cursor() as cur:
13971399
assert cur.execute("select 1").fetchall() == [(1,)]
1398-
if is_public_test:
1400+
if is_public_test or is_local_dev_setup:
13991401
assert "snowflake.connector.ocsp_snowflake" in caplog.text
14001402
assert "This connection does not perform OCSP checks." not in caplog.text
14011403
else:
14021404
assert "snowflake.connector.ocsp_snowflake" not in caplog.text
14031405

14041406

14051407
@pytest.mark.skipolddriver
1406-
def test_ocsp_mode_insecure_mode(conn_cnx, is_public_test, caplog):
1408+
def test_ocsp_mode_insecure_mode(conn_cnx, is_public_test, is_local_dev_setup, caplog):
14071409
caplog.set_level(logging.DEBUG, "snowflake.connector.ocsp_snowflake")
14081410
with conn_cnx(insecure_mode=True) as conn, conn.cursor() as cur:
14091411
assert cur.execute("select 1").fetchall() == [(1,)]
1410-
if is_public_test:
1411-
assert "snowflake.connector.ocsp_snowflake" not in caplog.text
1412+
assert "snowflake.connector.ocsp_snowflake" not in caplog.text
1413+
if is_public_test or is_local_dev_setup:
14121414
assert "This connection does not perform OCSP checks." in caplog.text
1413-
else:
1414-
assert "snowflake.connector.ocsp_snowflake" not in caplog.text
14151415

14161416

14171417
@pytest.mark.skipolddriver
14181418
def test_ocsp_mode_insecure_mode_and_disable_ocsp_checks_match(
1419-
conn_cnx, is_public_test, caplog
1419+
conn_cnx, is_public_test, is_local_dev_setup, caplog
14201420
):
14211421
caplog.set_level(logging.DEBUG, "snowflake.connector.ocsp_snowflake")
14221422
with conn_cnx(
14231423
insecure_mode=True, disable_ocsp_checks=True
14241424
) as conn, conn.cursor() as cur:
14251425
assert cur.execute("select 1").fetchall() == [(1,)]
1426-
if is_public_test:
1427-
assert "snowflake.connector.ocsp_snowflake" not in caplog.text
1426+
assert "snowflake.connector.ocsp_snowflake" not in caplog.text
1427+
if is_public_test or is_local_dev_setup:
14281428
assert (
14291429
"The values for 'disable_ocsp_checks' and 'insecure_mode' differ. "
14301430
"Using the value of 'disable_ocsp_checks."
14311431
) not in caplog.text
14321432
assert "This connection does not perform OCSP checks." in caplog.text
1433-
else:
1434-
assert "snowflake.connector.ocsp_snowflake" not in caplog.text
14351433

14361434

14371435
@pytest.mark.skipolddriver
14381436
def test_ocsp_mode_insecure_mode_and_disable_ocsp_checks_mismatch_ocsp_disabled(
1439-
conn_cnx, is_public_test, caplog
1437+
conn_cnx, is_public_test, is_local_dev_setup, caplog
14401438
):
14411439
caplog.set_level(logging.DEBUG, "snowflake.connector.ocsp_snowflake")
14421440
with conn_cnx(
14431441
insecure_mode=False, disable_ocsp_checks=True
14441442
) as conn, conn.cursor() as cur:
14451443
assert cur.execute("select 1").fetchall() == [(1,)]
1446-
if is_public_test:
1447-
assert "snowflake.connector.ocsp_snowflake" not in caplog.text
1444+
assert "snowflake.connector.ocsp_snowflake" not in caplog.text
1445+
if is_public_test or is_local_dev_setup:
14481446
assert (
14491447
"The values for 'disable_ocsp_checks' and 'insecure_mode' differ. "
14501448
"Using the value of 'disable_ocsp_checks."
14511449
) in caplog.text
14521450
assert "This connection does not perform OCSP checks." in caplog.text
1453-
else:
1454-
assert "snowflake.connector.ocsp_snowflake" not in caplog.text
14551451

14561452

14571453
@pytest.mark.skipolddriver
14581454
def test_ocsp_mode_insecure_mode_and_disable_ocsp_checks_mismatch_ocsp_enabled(
1459-
conn_cnx, is_public_test, caplog
1455+
conn_cnx, is_public_test, is_local_dev_setup, caplog
14601456
):
14611457
caplog.set_level(logging.DEBUG, "snowflake.connector.ocsp_snowflake")
14621458
with conn_cnx(
14631459
insecure_mode=True, disable_ocsp_checks=False
14641460
) as conn, conn.cursor() as cur:
14651461
assert cur.execute("select 1").fetchall() == [(1,)]
1466-
if is_public_test:
1462+
if is_public_test or is_local_dev_setup:
14671463
assert "snowflake.connector.ocsp_snowflake" in caplog.text
14681464
assert (
14691465
"The values for 'disable_ocsp_checks' and 'insecure_mode' differ. "

0 commit comments

Comments
 (0)