Skip to content

Commit 8516080

Browse files
committed
Make stepdown test work with MongoDB-2.0.2.
MongoDB-2.0.1 wasn't closing connections during primary stepdown. That was fixed in 2.0.2.
1 parent 0f1c37f commit 8516080

File tree

2 files changed

+6
-2
lines changed

2 files changed

+6
-2
lines changed

test/replica/replset_tools.py

Lines changed: 5 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -199,7 +199,11 @@ def stepdown_primary():
199199
primary = get_primary()
200200
if primary:
201201
c = pymongo.Connection(primary)
202-
c.admin.command('replSetStepDown', 20)
202+
# replSetStepDown causes mongod to close all connections
203+
try:
204+
c.admin.command('replSetStepDown', 20)
205+
except:
206+
pass
203207

204208

205209
def restart_members(members):

test/replica/test_replica_set.py

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -160,7 +160,7 @@ def test_primary_failure(self):
160160
secondaries = c.secondaries
161161

162162
def primary_changed():
163-
for _ in xrange(20):
163+
for _ in xrange(30):
164164
if c.primary != primary:
165165
return True
166166
time.sleep(1)

0 commit comments

Comments
 (0)