Skip to content

(fix) tests: fix flaky test_no_connection_refused_on_timeout#769

Open
mykaul wants to merge 1 commit intomasterfrom
fix/flaky-lwt-timeout-test
Open

(fix) tests: fix flaky test_no_connection_refused_on_timeout#769
mykaul wants to merge 1 commit intomasterfrom
fix/flaky-lwt-timeout-test

Conversation

@mykaul
Copy link
Copy Markdown

@mykaul mykaul commented Mar 26, 2026

Summary

  • Fix flaky test_no_connection_refused_on_timeout test that causes intermittent CI failures (including on PR (fix) test: Fix KeyError in test_idle_heartbeat with connection repla… #762)
  • The test asserted that at least one WriteTimeout/WriteFailure must occur during 2000 concurrent LWT operations, but this is non-deterministic -- if the cluster handles all ops without timeout, the assertion fails
  • The actual purpose of the test (PYTHON-91) is to verify the connection remains functional after LWT timeout stress

Changes

  • tests/integration/standard/test_query.py: Replace the non-deterministic assert received_timeout with a post-execution liveness check that verifies the session can still execute queries after the LWT stress. Log a warning when the timeout path is not exercised.

Root cause

The CI failure on PR #762 (test libev (3.14)) was caused by this flaky test, not by the PR's actual changes (which only modify test_cluster.py). The test failed because the 2000 concurrent LWT INSERT operations all completed without triggering a WriteTimeout or WriteFailure.

@mykaul mykaul force-pushed the fix/flaky-lwt-timeout-test branch from cb979cb to e5dc0bb Compare March 27, 2026 05:45
The test asserted that at least one WriteTimeout/WriteFailure must occur
during 2000 concurrent LWT operations, but this is non-deterministic --
if the cluster handles all ops without timeout, the assertion fails.

The actual purpose (PYTHON-91) is to verify the connection remains
functional after LWT timeout stress. Replace the timeout assertion with
a post-execution liveness check that verifies the session can still
execute queries, and log a warning when the timeout path is not
exercised.
@mykaul mykaul force-pushed the fix/flaky-lwt-timeout-test branch from e5dc0bb to 5478b79 Compare March 27, 2026 06:46
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.

1 participant