PYTHON-2948 Add prose test for SRV polling with a custom service name (#764)

This commit is contained in:
Julius Park 2021-10-26 17:49:22 -07:00 committed by GitHub
parent bfa5aafb34
commit ca46cb20bd
No known key found for this signature in database
GPG Key ID: 4AEE18F83AFDEB23

View File

@ -289,6 +289,24 @@ class TestSrvPolling(unittest.TestCase):
new = set(client.topology_description.server_descriptions())
self.assertSetEqual(old, new)
def test_srv_service_name(self):
# Construct a valid final response callback distinct from base.
response = [
("localhost.test.build.10gen.cc.", 27019),
("localhost.test.build.10gen.cc.", 27020)
]
def nodelist_callback():
return response
with SrvPollingKnobs(
ttl_time=WAIT_TIME, min_srv_rescan_interval=WAIT_TIME):
client = MongoClient(
"mongodb+srv://test22.test.build.10gen.cc/?srvServiceName"
"=customname")
with SrvPollingKnobs(nodelist_callback=nodelist_callback):
self.assert_nodelist_change(response, client)
if __name__ == '__main__':
unittest.main()