Skip to content

PYTHON-5474 Wait until all mongoses are discovered for mongos retry tests - #3153

Merged
NoahStapp merged 1 commit into
mongodb:mainfrom
NoahStapp:PYTHON-5474
Oct 27, 2026
Merged

NoahStapp merged 1 commit into
mongodb:mainfrom
NoahStapp:PYTHON-5474

Conversation

@NoahStapp

@NoahStapp NoahStapp commented Oct 27, 2026 •

Copy link
Copy Markdown
Contributor

PYTHON-5474

Changes in this PR

Make retryable read and retryable write tests that require connecting to all mongoses in a cluster execute operations only after all mongoses are discovered.

Test Plan

Existing test changes.

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?

@NoahStapp
NoahStapp requested a review from a team as a code owner October 27, 2026 14:59
@NoahStapp
NoahStapp requested review from blink1073 and a balanced review from Copilot October 27, 2026 14:59
@NoahStapp NoahStapp changed the title PYTHON-5474 Wait until all mongoses are discovered for mongos retry t… PYTHON-5474 Wait until all mongoses are discovered for mongos retry tests Oct 27, 2026

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.

🟢 Approval recommended

The narrow test changes use existing bounded polling helpers, and no unresolved issues were identified.

No open issues 🎉

What changed in this PR

This PR reduces discovery-related flakiness in PyMongo’s sharded-cluster retry tests by waiting for all configured mongoses before exercising retry behavior.

Changes:

  • Add discovery waits to asynchronous retryable-read and retryable-write tests.
  • Mirror the waits in generated synchronous tests.
  • Remove unused os imports from retryable-read test files.
File Description
test/​test_retryable_writes.py Mirrors the mongos discovery wait for synchronous write retries.
test/​test_retryable_reads.py Mirrors the read-retry discovery wait and removes an unused import.
test/​asynchronous/​test_retryable_writes.py Awaits all mongoses before testing write retries.
test/​asynchronous/​test_retryable_reads.py Awaits all mongoses before testing read retries and removes an unused import.

Review effort: Balanced

@blink1073 blink1073 left a comment

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.

LGTM

@NoahStapp
NoahStapp merged commit eb178ac into mongodb:main Oct 27, 2026
80 checks passed
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.

3 participants