Skip to content

Commit ca46cb2

Browse files
authored
PYTHON-2948 Add prose test for SRV polling with a custom service name (#764)
1 parent bfa5aaf commit ca46cb2

File tree

1 file changed

+18
-0
lines changed

1 file changed

+18
-0
lines changed

test/test_srv_polling.py

Lines changed: 18 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -289,6 +289,24 @@ def test_does_not_flipflop(self):
289289
new = set(client.topology_description.server_descriptions())
290290
self.assertSetEqual(old, new)
291291

292+
def test_srv_service_name(self):
293+
# Construct a valid final response callback distinct from base.
294+
response = [
295+
("localhost.test.build.10gen.cc.", 27019),
296+
("localhost.test.build.10gen.cc.", 27020)
297+
]
298+
299+
def nodelist_callback():
300+
return response
301+
302+
with SrvPollingKnobs(
303+
ttl_time=WAIT_TIME, min_srv_rescan_interval=WAIT_TIME):
304+
client = MongoClient(
305+
"mongodb+srv://test22.test.build.10gen.cc/?srvServiceName"
306+
"=customname")
307+
with SrvPollingKnobs(nodelist_callback=nodelist_callback):
308+
self.assert_nodelist_change(response, client)
309+
292310

293311
if __name__ == '__main__':
294312
unittest.main()

0 commit comments

Comments
 (0)