Skip to content

Commit c9b79b9

Browse files
sfc-gh-mmishchenkosfc-gh-pczajka
authored andcommitted
NO-SNOW mark OCSP unit tests flaky (#2276)
1 parent 529c8c1 commit c9b79b9

File tree

2 files changed

+10
-3
lines changed

2 files changed

+10
-3
lines changed

test/integ/sso/test_unit_mfa_cache.py

Lines changed: 2 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -12,11 +12,10 @@
1212
import pytest
1313

1414
import snowflake.connector
15-
from snowflake.connector.compat import IS_LINUX
1615
from snowflake.connector.errors import DatabaseError
1716

1817
try:
19-
from snowflake.connector.compat import IS_MACOS
18+
from snowflake.connector.compat import IS_LINUX, IS_MACOS, IS_WINDOWS
2019
except ImportError:
2120
import platform
2221

@@ -172,7 +171,7 @@ def test_body(conn_cfg):
172171
if IS_LINUX:
173172
conn_cfg["client_request_mfa_token"] = True
174173

175-
if IS_MACOS:
174+
if IS_MACOS or IS_WINDOWS:
176175
with patch(
177176
"keyring.delete_password", Mock(side_effect=mock_del_password)
178177
), patch("keyring.set_password", Mock(side_effect=mock_set_password)), patch(

test/unit/test_ocsp.py

Lines changed: 8 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -221,6 +221,7 @@ def test_ocsp_bad_validity():
221221
del environ["SF_TEST_OCSP_FORCE_BAD_RESPONSE_VALIDITY"]
222222

223223

224+
@pytest.mark.flaky(reruns=3)
224225
def test_ocsp_single_endpoint():
225226
environ["SF_OCSP_ACTIVATE_NEW_ENDPOINT"] = "True"
226227
SnowflakeOCSP.clear_cache()
@@ -244,6 +245,7 @@ def test_ocsp_by_post_method():
244245
assert ocsp.validate(url, connection), f"Failed to validate: {url}"
245246

246247

248+
@pytest.mark.flaky(reruns=3)
247249
def test_ocsp_with_file_cache(tmpdir):
248250
"""OCSP tests and the cache server and file."""
249251
tmp_dir = str(tmpdir.mkdir("ocsp_response_cache"))
@@ -257,6 +259,7 @@ def test_ocsp_with_file_cache(tmpdir):
257259
assert ocsp.validate(url, connection), f"Failed to validate: {url}"
258260

259261

262+
@pytest.mark.flaky(reruns=3)
260263
@pytest.mark.skipolddriver
261264
def test_ocsp_with_bogus_cache_files(tmpdir, random_ocsp_response_validation_cache):
262265
with mock.patch(
@@ -296,6 +299,7 @@ def test_ocsp_with_bogus_cache_files(tmpdir, random_ocsp_response_validation_cac
296299
)
297300

298301

302+
@pytest.mark.flaky(reruns=3)
299303
@pytest.mark.skipolddriver
300304
def test_ocsp_with_outdated_cache(tmpdir, random_ocsp_response_validation_cache):
301305
with mock.patch(
@@ -356,6 +360,7 @@ def _store_cache_in_file(tmpdir, target_hosts=None):
356360
return filename, target_hosts
357361

358362

363+
@pytest.mark.flaky(reruns=3)
359364
def test_ocsp_with_invalid_cache_file():
360365
"""OCSP tests with an invalid cache file."""
361366
SnowflakeOCSP.clear_cache() # reset the memory cache
@@ -365,6 +370,7 @@ def test_ocsp_with_invalid_cache_file():
365370
assert ocsp.validate(url, connection), f"Failed to validate: {url}"
366371

367372

373+
@pytest.mark.flaky(reruns=3)
368374
@mock.patch(
369375
"snowflake.connector.ocsp_snowflake.SnowflakeOCSP._fetch_ocsp_response",
370376
side_effect=BrokenPipeError("fake error"),
@@ -387,6 +393,7 @@ def test_ocsp_cache_when_server_is_down(
387393
assert not cache_data, "no cache should present because of broken pipe"
388394

389395

396+
@pytest.mark.flaky(reruns=3)
390397
def test_concurrent_ocsp_requests(tmpdir):
391398
"""Run OCSP revocation checks in parallel. The memory and file caches are deleted randomly."""
392399
cache_file_name = path.join(str(tmpdir), "cache_file.txt")
@@ -431,6 +438,7 @@ def test_ocsp_revoked_certificate():
431438
assert ex.value.errno == ex.value.errno == ER_OCSP_RESPONSE_CERT_STATUS_REVOKED
432439

433440

441+
@pytest.mark.flaky(reruns=3)
434442
def test_ocsp_incomplete_chain():
435443
"""Tests incomplete chained certificate."""
436444
incomplete_chain_cert = path.join(

0 commit comments

Comments
 (0)