Skip to content

Commit ddbd2dd

Browse files
committed
PYTHON-1062 - Only use "textSearchEnabled" when testing MongoDB 2.4
1 parent 07b0f78 commit ddbd2dd

File tree

1 file changed

+10
-8
lines changed

1 file changed

+10
-8
lines changed

test/utils.py

Lines changed: 10 additions & 8 deletions
Original file line numberDiff line numberDiff line change
@@ -273,14 +273,16 @@ def is_mongos(client):
273273

274274

275275
def enable_text_search(client):
276-
client.admin.command(
277-
'setParameter', textSearchEnabled=True)
278-
279-
for host, port in client.secondaries:
280-
client = MongoClient(host, port)
281-
if client_context.auth_enabled:
282-
client.admin.authenticate(db_user, db_pwd)
283-
client.admin.command('setParameter', textSearchEnabled=True)
276+
sinfo = client.server_info()
277+
if 'versionArray' in sinfo and sinfo['versionArray'][:2] == [2, 4]:
278+
client.admin.command(
279+
'setParameter', textSearchEnabled=True)
280+
281+
for host, port in client.secondaries:
282+
client = MongoClient(host, port)
283+
if client_context.auth_enabled:
284+
client.admin.authenticate(db_user, db_pwd)
285+
client.admin.command('setParameter', textSearchEnabled=True)
284286

285287

286288
def assertRaisesExactly(cls, fn, *args, **kwargs):

0 commit comments

Comments
 (0)