-
Notifications
You must be signed in to change notification settings - Fork 1.1k
PYTHON-2480: Add MongoClient helper to access the current TopologyDescription #583
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
Conversation
prashantmital
left a comment
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Since we are adding a public property we also want to add something to test_client.py that would result in a failure if we ever inadvertently removed this property from MongoClient. The simplest( and most naive) approach to testing this would be to add a test to ClientUnitTest that checks that client.topology_description returns the same object as client._topology._description.
ShaneHarvey
left a comment
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Great work. Just one quick ask.
| self.assertFalse(c.secondaries) | ||
| c = rs_or_single_client(connect=False) | ||
| self.assertIsInstance(c.max_write_batch_size, int) | ||
| self.assertIsInstance(c.topology_description, TopologyDescription) |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Nicely done.
Add a property for accessing current topology description in MongoClient.
Open Questions:
How to test these changes/run locally?