Skip to content

Commit e009a60

Browse files
NO-SNOW add flag for local test setup (#2397)
1 parent 5228cd0 commit e009a60

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
@@ -95,6 +95,11 @@ def is_public_testaccount() -> bool:
9595
return running_on_public_ci() or db_parameters["account"].startswith("sfctest0")
9696

9797

98+
@pytest.fixture(scope="session")
99+
def is_local_dev_setup(db_parameters) -> bool:
100+
return db_parameters.get("is_local_dev_setup", False)
101+
102+
98103
@pytest.fixture(scope="session")
99104
def db_parameters() -> dict[str, str]:
100105
return get_db_parameters()

test/integ/test_connection.py

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

13711371

13721372
@pytest.mark.skipolddriver
1373-
def test_ocsp_mode_disable_ocsp_checks(conn_cnx, is_public_test, caplog):
1373+
def test_ocsp_mode_disable_ocsp_checks(
1374+
conn_cnx, is_public_test, is_local_dev_setup, caplog
1375+
):
13741376
caplog.set_level(logging.DEBUG, "snowflake.connector.ocsp_snowflake")
13751377
with conn_cnx(disable_ocsp_checks=True) as conn, conn.cursor() as cur:
13761378
assert cur.execute("select 1").fetchall() == [(1,)]
@@ -1379,75 +1381,69 @@ def test_ocsp_mode_disable_ocsp_checks(conn_cnx, is_public_test, caplog):
13791381

13801382
with conn_cnx() as conn, conn.cursor() as cur:
13811383
assert cur.execute("select 1").fetchall() == [(1,)]
1382-
if is_public_test:
1384+
if is_public_test or is_local_dev_setup:
13831385
assert "snowflake.connector.ocsp_snowflake" in caplog.text
13841386
assert "This connection does not perform OCSP checks." not in caplog.text
13851387
else:
13861388
assert "snowflake.connector.ocsp_snowflake" not in caplog.text
13871389

13881390

13891391
@pytest.mark.skipolddriver
1390-
def test_ocsp_mode_insecure_mode(conn_cnx, is_public_test, caplog):
1392+
def test_ocsp_mode_insecure_mode(conn_cnx, is_public_test, is_local_dev_setup, caplog):
13911393
caplog.set_level(logging.DEBUG, "snowflake.connector.ocsp_snowflake")
13921394
with conn_cnx(insecure_mode=True) as conn, conn.cursor() as cur:
13931395
assert cur.execute("select 1").fetchall() == [(1,)]
1394-
if is_public_test:
1395-
assert "snowflake.connector.ocsp_snowflake" not in caplog.text
1396+
assert "snowflake.connector.ocsp_snowflake" not in caplog.text
1397+
if is_public_test or is_local_dev_setup:
13961398
assert "This connection does not perform OCSP checks." in caplog.text
1397-
else:
1398-
assert "snowflake.connector.ocsp_snowflake" not in caplog.text
13991399

14001400

14011401
@pytest.mark.skipolddriver
14021402
def test_ocsp_mode_insecure_mode_and_disable_ocsp_checks_match(
1403-
conn_cnx, is_public_test, caplog
1403+
conn_cnx, is_public_test, is_local_dev_setup, caplog
14041404
):
14051405
caplog.set_level(logging.DEBUG, "snowflake.connector.ocsp_snowflake")
14061406
with conn_cnx(
14071407
insecure_mode=True, disable_ocsp_checks=True
14081408
) as conn, conn.cursor() as cur:
14091409
assert cur.execute("select 1").fetchall() == [(1,)]
1410-
if is_public_test:
1411-
assert "snowflake.connector.ocsp_snowflake" not in caplog.text
1410+
assert "snowflake.connector.ocsp_snowflake" not in caplog.text
1411+
if is_public_test or is_local_dev_setup:
14121412
assert (
14131413
"The values for 'disable_ocsp_checks' and 'insecure_mode' differ. "
14141414
"Using the value of 'disable_ocsp_checks."
14151415
) not in caplog.text
14161416
assert "This connection does not perform OCSP checks." in caplog.text
1417-
else:
1418-
assert "snowflake.connector.ocsp_snowflake" not in caplog.text
14191417

14201418

14211419
@pytest.mark.skipolddriver
14221420
def test_ocsp_mode_insecure_mode_and_disable_ocsp_checks_mismatch_ocsp_disabled(
1423-
conn_cnx, is_public_test, caplog
1421+
conn_cnx, is_public_test, is_local_dev_setup, caplog
14241422
):
14251423
caplog.set_level(logging.DEBUG, "snowflake.connector.ocsp_snowflake")
14261424
with conn_cnx(
14271425
insecure_mode=False, disable_ocsp_checks=True
14281426
) as conn, conn.cursor() as cur:
14291427
assert cur.execute("select 1").fetchall() == [(1,)]
1430-
if is_public_test:
1431-
assert "snowflake.connector.ocsp_snowflake" not in caplog.text
1428+
assert "snowflake.connector.ocsp_snowflake" not in caplog.text
1429+
if is_public_test or is_local_dev_setup:
14321430
assert (
14331431
"The values for 'disable_ocsp_checks' and 'insecure_mode' differ. "
14341432
"Using the value of 'disable_ocsp_checks."
14351433
) in caplog.text
14361434
assert "This connection does not perform OCSP checks." in caplog.text
1437-
else:
1438-
assert "snowflake.connector.ocsp_snowflake" not in caplog.text
14391435

14401436

14411437
@pytest.mark.skipolddriver
14421438
def test_ocsp_mode_insecure_mode_and_disable_ocsp_checks_mismatch_ocsp_enabled(
1443-
conn_cnx, is_public_test, caplog
1439+
conn_cnx, is_public_test, is_local_dev_setup, caplog
14441440
):
14451441
caplog.set_level(logging.DEBUG, "snowflake.connector.ocsp_snowflake")
14461442
with conn_cnx(
14471443
insecure_mode=True, disable_ocsp_checks=False
14481444
) as conn, conn.cursor() as cur:
14491445
assert cur.execute("select 1").fetchall() == [(1,)]
1450-
if is_public_test:
1446+
if is_public_test or is_local_dev_setup:
14511447
assert "snowflake.connector.ocsp_snowflake" in caplog.text
14521448
assert (
14531449
"The values for 'disable_ocsp_checks' and 'insecure_mode' differ. "

0 commit comments

Comments
 (0)