Skip to content

PYTHON-5974 Loosen baseBackoffMS prose test timing - #2967

Open
NoahStapp wants to merge 1 commit into
mongodb:mainfrom
NoahStapp:PYTHON-5974
Open

PYTHON-5974 Loosen baseBackoffMS prose test timing#2967
NoahStapp wants to merge 1 commit into
mongodb:mainfrom
NoahStapp:PYTHON-5974

Conversation

@NoahStapp

@NoahStapp NoahStapp commented Jul 29, 2026

Copy link
Copy Markdown
Contributor

PYTHON-5974

Changes in this PR

Loosens timing requirements for the affected test to allow for the slight variation seen between platforms. Asyncio running on Windows + Python <= 3.12 has a rougher granularity for loop timers that can cause the test to fail.

Test Plan

Test change.

Checklist

Checklist for Author

  • [ ] Did you update the changelog (if necessary)?
  • Is there test coverage?
  • [ ] Is any followup work tracked in a JIRA ticket? If so, add link(s).

Checklist for Reviewer

  • Does the title of the PR reference a JIRA Ticket?
  • Do you fully understand the implementation? (Would you be comfortable explaining how this code works to someone else?)
  • Is all relevant documentation (README or docstring) updated?

Copilot AI left a comment

Copy link
Copy Markdown
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Pull request overview

This PR loosens the lower-bound timing assertions in the Client Backpressure spec test that measures baseBackoffMS-related retry delays, reducing test flakiness caused by timing variance across environments.

Changes:

  • Reduced the minimum expected duration for the default exponential backoff run (0.6s → 0.55s).
  • Reduced the minimum expected duration for the baseBackoffMS=50 run (0.3s → 0.25s).
  • Added an explanatory comment about timing slack (but currently phrased inconsistently with the assertions and the sync/async variants).

Reviewed changes

Copilot reviewed 2 out of 2 changed files in this pull request and generated 2 comments.

File Description
test/test_client_backpressure.py Loosens lower-bound timing assertions for the synchronous prose test.
test/asynchronous/test_client_backpressure.py Loosens lower-bound timing assertions for the asynchronous prose test.

Comment thread test/test_client_backpressure.py
Comment thread test/asynchronous/test_client_backpressure.py
@NoahStapp

Copy link
Copy Markdown
Contributor Author

auth-aws-ecs-macos is a known failure, will be resolved by our lockfile fix.

@codecov-commenter

Copy link
Copy Markdown

Codecov Report

✅ All modified and coverable lines are covered by tests.

📢 Thoughts on this report? Let us know!

# and the baseBackoffMS=50 backoffs are 0.1 + 0.2 = 0.3s.
self.assertGreaterEqual(exponential_backoff_time, 0.6)
self.assertGreaterEqual(with_base_backoff_ms_time, 0.3)
# Allow for slight timing slack due to asyncio timing resolution on Windows <= Python 3.12

Copy link
Copy Markdown
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Can we only set the different timings in this scenario, to align with the spec otherwise?

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.

4 participants