Skip to content

tests: don't time the SSL session cache deadline test with sleep - #1099

Merged
roydahan merged 1 commit into
scylladb:masterfrom
mykaul:tests/ssl-cache-no-sleep
Oct 6, 2026
Merged

roydahan merged 1 commit into
scylladb:masterfrom
mykaul:tests/ssl-cache-no-sleep

Conversation

@mykaul

@mykaul mykaul commented Oct 5, 2026 •

Copy link
Copy Markdown

test_the_same_session_again_keeps_the_deadline_it_had fails intermittently in the Windows wheel builds, e.g. on #1089 (job, cp310-win_amd64):

AssertionError: assert <tests.unit.test_ssl_session_cache._Session object ...> is None

Cause: the test stores a 50 ms deadline, sleeps 60 ms and expects the entry to have expired. On Windows before Python 3.13, time.monotonic() advances in 15.625 ms ticks, so after 60 ms of sleep the clock can read only 46.9 ms later, short of the deadline. @roydahan analysed this in a comment on #1052 and measured a 14% failure rate with a quantized clock.

Fix: store the first session already expired (lifetime=-1), as the neighbouring tests do, and drop the sleep. Re-storing the same session must keep the expired deadline, so the lookup still has to miss, with no clock involved. The time import is now unused, so it goes too.

Tests: pytest tests/unit/test_ssl_session_cache.py passes (31 tests). With set() changed to give a re-stored session a fresh deadline, this test fails, so it still guards what it's meant to.

🤖 Generated with Claude Code

test_the_same_session_again_keeps_the_deadline_it_had stored a 50 ms
deadline, slept 60 ms and expected the entry gone. On Windows before
Python 3.13, time.monotonic() advances in 15.625 ms ticks, so 60 ms of
sleep can read as 46.9 ms and the entry is still returned.

Store the first session already expired instead, as the neighbouring
tests do. Re-storing the same session must keep that deadline, so the
lookup still has to miss; no clock is involved.

Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com>
@coderabbitai

coderabbitai Bot commented Oct 5, 2026

Copy link
Copy Markdown

Warning

Review limit reached

You've used all free OSS reviews for now. Wait for the free limit to reset to keep reviewing this public repository.

Next included review available in 27 minutes.

Check out review usage here.

View limit details

Limit details: You’ve used the included review currently available.

Learn how review limits work.

Review configuration:

⚙️ Run configuration
  • Configuration used: Organization UI
  • Review profile: QUIET
  • Plan: Advanced
  • Run ID: 1bb0ae52-ed7e-4588-b13b-ea9b31efe9ae
📥 Commits

Reviewing files that changed from the base of the PR and between ecc8bcc and 977ee24.

📒 Files selected for processing (1)
  • tests/unit/test_ssl_session_cache.py
  • Autopilot · Keep fixing CodeRabbit findings and required CI, and resolving merge conflicts

Thanks for using CodeRabbit! It's free for OSS, and your support helps us grow. If you like it, consider giving us a shout-out.

❤️ Share

Comment @coderabbitai help to get the list of available commands.

@roydahan
roydahan merged commit 0a4cb1b into scylladb:master Oct 6, 2026
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

2 participants