Skip to content

Commit 98c662e

Browse files
Fix the test when run against newer MongoDBs. (pandas-dev#241)
We raise an OperationFailure exception when something goes wrong querying the database as a secondary. Arctic retries querying the primary only, and we assert that data comes back.
1 parent 86b9596 commit 98c662e

File tree

1 file changed

+3
-2
lines changed

1 file changed

+3
-2
lines changed

tests/integration/store/test_version_store.py

+3-2
Original file line numberDiff line numberDiff line change
@@ -112,9 +112,10 @@ def test_read_item_read_preference_SECONDARY(library_secondary, library_name):
112112
def test_query_falls_back_to_primary(library_secondary, library_name):
113113
allow_secondary = [True]
114114
def _query(options, *args, **kwargs):
115-
# If we're allowing secondary read then raise when reading a chunk.
115+
# If we're allowing secondary read and an error occurs when reading a chunk.
116116
# We should attempt a call to primary only subsequently.
117-
if args[0] == 'arctic_{}'.format(library_name) and \
117+
# In newer MongoDBs we query <database>.$cmd rather than <database>.<collection>
118+
if args[0].startswith('arctic_{}.'.format(library_name.split('.')[0])) and \
118119
bool(options & _QUERY_OPTIONS['slave_okay']) == True:
119120
allow_secondary[0] = False
120121
raise OperationFailure("some_error")

0 commit comments

Comments
 (0)