Skip to content

Commit 807f719

Browse files
author
Luke Lovett
committed
PYTHON-1178 - Fix race in test_local_threshold test.
1 parent 9128866 commit 807f719

File tree

1 file changed

+8
-2
lines changed

1 file changed

+8
-2
lines changed

test/test_mongos_load_balancing.py

Lines changed: 8 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -161,8 +161,14 @@ def test_local_threshold(self):
161161
client.db.command('ismaster')
162162
except:
163163
pass
164-
# No error
165-
client.db.command('ismaster')
164+
165+
# We eventually connect to a new mongos.
166+
def connect_to_new_mongos():
167+
try:
168+
return client.db.command('ismaster')
169+
except AutoReconnect:
170+
pass
171+
wait_until(connect_to_new_mongos, 'connect to a new mongos')
166172

167173
def test_load_balancing(self):
168174
# Although the server selection JSON tests already prove that

0 commit comments

Comments
 (0)