Skip to content

PYTHON-5631 - test_direct_client_maintains_pool_to_arbiter waits inst… - #2798

Merged
NoahStapp merged 1 commit into
mongodb:masterfrom
NoahStapp:PYTHON-5631
May 13, 2026
Merged

NoahStapp merged 1 commit into
mongodb:masterfrom
NoahStapp:PYTHON-5631

Conversation

@NoahStapp

@NoahStapp NoahStapp commented May 7, 2026 •

Copy link
Copy Markdown
Contributor

…ead of asserting

PYTHON-5631

Changes in this PR

Have test_direct_client_maintains_pool_to_arbiter wait until the pooled connection is registered rather than asserting immediately and risking a race.

Test Plan

Test fix only.

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 May 7, 2026 20:47
@NoahStapp
NoahStapp requested review from aclark4life and Copilot May 7, 2026 20:47

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 updates the test_direct_client_maintains_pool_to_arbiter test to avoid a race by waiting until the arbiter’s pooled connection is actually present in the pool, instead of asserting immediately.

Changes:

  • Replace a direct assertion on len(arbiter.pool.conns) with wait_until(...) / async_wait_until(...) to reduce test flakiness.
  • Adjust the nearby comment to reflect the new “wait” behavior.

Reviewed changes

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

File Description
test/test_client.py Makes the synchronous version of the test wait until the arbiter pool connection is registered before asserting.
test/asynchronous/test_client.py Mirrors the same race-avoidance change for the asynchronous test.

@codecov-commenter

codecov-commenter commented May 7, 2026 •

Copy link
Copy Markdown

Codecov Report

✅ All modified and coverable lines are covered by tests.

📢 Thoughts on this report? Let us know!

@NoahStapp

NoahStapp commented May 8, 2026 •

Copy link
Copy Markdown
Contributor Author

Test failure is an unrelated known flaky CSOT test.

@codeowners-service-app

Copy link
Copy Markdown

Assigned sophiayangDB for team dbx-python because aclark4life is out of office.

@sophiayangDB sophiayangDB 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.

LGTM!

@NoahStapp
NoahStapp merged commit 552b7bf into mongodb:master May 13, 2026
91 of 93 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.

4 participants