Skip to content

PYTHON-5875 - Call setParameter on each mongos for test_connection_po… - #2906

Merged
NoahStapp merged 2 commits into
mongodb:masterfrom
NoahStapp:PYTHON-5875-1
Jul 1, 2026
Merged

NoahStapp merged 2 commits into
mongodb:masterfrom
NoahStapp:PYTHON-5875-1

Conversation

@NoahStapp

@NoahStapp NoahStapp commented Jun 30, 2026 •

Copy link
Copy Markdown
Contributor

…ol_is_not_cleared

PYTHON-5875

Changes in this PR

test_connection_pool_is_not_cleared uses setParameter, which only applies to the server executed on. This change calls setParameter on each mongos in a sharded cluster for the test, falling back to the current behavior for other topologies.

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 review requested due to automatic review settings June 30, 2026 20:52
@NoahStapp
NoahStapp requested a review from a team as a code owner June 30, 2026 20:52
@NoahStapp
NoahStapp requested a review from aclark4life June 30, 2026 20:52

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 pool-backpressure test test_connection_pool_is_not_cleared to apply setParameter to each mongos when running against a sharded cluster, while preserving the existing behavior for non-sharded topologies.

Changes:

  • Detect sharded cluster topology via *_client_context.mongoses and create per-mongos admin clients.
  • Run the ingress rate limiter setParameter commands on each mongos (sync + async).
  • Disable the rate limiter in teardown across all targeted mongos instances (sync + async).

Reviewed changes

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

File Description
test/test_discovery_and_monitoring.py Run ingress rate limiter setParameter on all mongos instances in sharded clusters for the sync test.
test/asynchronous/test_discovery_and_monitoring.py Mirror the same multi-mongos setParameter behavior for the async test.

Comment thread test/test_discovery_and_monitoring.py Resolved
Comment thread test/test_discovery_and_monitoring.py Resolved
@codecov-commenter

Copy link
Copy Markdown

Codecov Report

✅ All modified and coverable lines are covered by tests.

📢 Thoughts on this report? Let us know!

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

Looks like the 🤖 may be on to something with:

The async teardown cleanup is registered after the setParameter calls. If enabling/configuring the rate limiter raises, it can remain enabled and impact later tests. Register the cleanup before issuing setParameter so it still runs on early failures.

The IP formatting issue could be fixed too, but then we should probably fix other uses of that syntax elsewhere in the code. Maybe a new ticket for that (if you think the suggested formatting is better) and merge this one with the IP formatting as-is.

@NoahStapp
NoahStapp requested review from aclark4life and Copilot and removed request for aclark4life July 1, 2026 13:51

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

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

@aclark4life

Copy link
Copy Markdown
Contributor

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

How did you get copilot to give up on IP formatting? Wondering if your comment or resolving does it.

Test failures unrelated right?

@NoahStapp

Copy link
Copy Markdown
Contributor Author

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

How did you get copilot to give up on IP formatting? Wondering if your comment or resolving does it.

Test failures unrelated right?

Yes, resolving does it. Test failures are all QE preview changes that will be resolved by PYTHON-5912.

@NoahStapp
NoahStapp merged commit 1ccf555 into mongodb:master Jul 1, 2026
82 of 88 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