Skip to content

Commit 959b395

Browse files
committed
Fix infrequent read preference test failure
1 parent c4091d8 commit 959b395

File tree

1 file changed

+25
-25
lines changed

1 file changed

+25
-25
lines changed

test/test_read_preferences.py

Lines changed: 25 additions & 25 deletions
Original file line numberDiff line numberDiff line change
@@ -471,6 +471,31 @@ def test_command(self):
471471
ctx.exit()
472472

473473
# Obedient commands.
474+
# Geo stuff.
475+
self.c.pymongo_test.test.create_index([('location', '2d')])
476+
477+
self.c.pymongo_test.test.create_index([('location', 'geoHaystack'),
478+
('key', 1)], bucketSize=100)
479+
480+
# Attempt to await replication of indexes replicated.
481+
self.c.pymongo_test.test2.insert({}, w=self.w)
482+
self.c.pymongo_test.test2.remove({}, w=self.w)
483+
484+
self._test_fn(True, lambda: self.c.pymongo_test.command(
485+
'geoNear', 'test', near=[0, 0]))
486+
self._test_fn(True, lambda: self.c.pymongo_test.command(SON([
487+
('geoNear', 'test'), ('near', [0, 0])])))
488+
489+
self._test_fn(
490+
True, lambda: self.c.pymongo_test.command(
491+
'geoSearch', 'test', near=[33, 33], maxDistance=6,
492+
search={'type': 'restaurant'}, limit=30))
493+
494+
self._test_fn(
495+
True, lambda: self.c.pymongo_test.command(SON([
496+
('geoSearch', 'test'), ('near', [33, 33]), ('maxDistance', 6),
497+
('search', {'type': 'restaurant'}), ('limit', 30)])))
498+
474499
self._test_fn(True, lambda: self.c.pymongo_test.command('group', {
475500
'ns': 'test', 'key': {'a': 1}, '$reduce': 'function(obj, prev) { }',
476501
'initial': {}}))
@@ -498,31 +523,6 @@ def test_command(self):
498523
self._test_fn(True, lambda: self.c.pymongo_test.command(SON([
499524
('distinct', 'test'), ('key', 'a'), ('query', {'a': 1})])))
500525

501-
# Geo stuff.
502-
self.c.pymongo_test.test.create_index([('location', '2d')])
503-
504-
self.c.pymongo_test.test.create_index([('location', 'geoHaystack'),
505-
('key', 1)], bucketSize=100)
506-
507-
# Attempt to await replication of indexes replicated.
508-
self.c.pymongo_test.test2.insert({}, w=self.w)
509-
self.c.pymongo_test.test2.remove({}, w=self.w)
510-
511-
self._test_fn(True, lambda: self.c.pymongo_test.command(
512-
'geoNear', 'test', near=[0, 0]))
513-
self._test_fn(True, lambda: self.c.pymongo_test.command(SON([
514-
('geoNear', 'test'), ('near', [0, 0])])))
515-
516-
self._test_fn(
517-
True, lambda: self.c.pymongo_test.command(
518-
'geoSearch', 'test', near=[33, 33], maxDistance=6,
519-
search={'type': 'restaurant'}, limit=30))
520-
521-
self._test_fn(
522-
True, lambda: self.c.pymongo_test.command(SON([
523-
('geoSearch', 'test'), ('near', [33, 33]), ('maxDistance', 6),
524-
('search', {'type': 'restaurant'}), ('limit', 30)])))
525-
526526
if (version.at_least(self.c, (2, 1, 0)) and
527527
not version.at_least(self.c, (3, 5, 1))):
528528
self._test_fn(

0 commit comments

Comments
 (0)