Skip to content

Commit 65a768d

Browse files
committed
Test reliability...
1 parent 5a6ad51 commit 65a768d

File tree

1 file changed

+9
-1
lines changed

1 file changed

+9
-1
lines changed

test/test_pooling_base.py

Lines changed: 9 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -804,7 +804,15 @@ def find_slow():
804804

805805
# Javascript function that pauses N seconds per document
806806
fn = delay(10)
807-
self.assertEqual(1, db.test.find({"$where": fn}).count())
807+
if is_mongos(db.connection):
808+
# mongos doesn't support eval so we have to use $where
809+
# which is less reliable in this context.
810+
self.assertEqual(1, db.test.find({"$where": fn}).count())
811+
else:
812+
# 'nolock' allows find_fast to start and finish while we're
813+
# waiting for this to complete.
814+
self.assertEqual({'ok': 1.0, 'retval': True},
815+
db.command('eval', fn, nolock=True))
808816

809817
history.append('find_slow done')
810818

0 commit comments

Comments
 (0)