Skip to content

Commit 52a6aba

Browse files
committed
add workaround for SERVER-108463
1 parent 3bbd99d commit 52a6aba

File tree

2 files changed

+12
-2
lines changed

2 files changed

+12
-2
lines changed

test/asynchronous/test_cursor.py

Lines changed: 6 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -369,7 +369,12 @@ async def test_explain_csot(self):
369369
client = await self.async_rs_or_single_client(event_listeners=[listener])
370370

371371
# Create a collection, referred to as collection, with the namespace explain-test.collection.
372-
collection = client["explain-test"]["collection"]
372+
# Workaround for SERVER-108463
373+
names = client["explain-test"].list_collection_names()
374+
if "collection" not in names:
375+
collection = client["explain-test"].create_collection("collection")
376+
else:
377+
collection = client["explain-test"]["collection"]
373378

374379
# Run an explained find on collection. The find will have the query predicate { name: 'john doe' }. Specify a maxTimeMS value of 2000ms for the explain.
375380
with pymongo.timeout(2.0):

test/test_cursor.py

Lines changed: 6 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -361,7 +361,12 @@ def test_explain_csot(self):
361361
client = self.rs_or_single_client(event_listeners=[listener])
362362

363363
# Create a collection, referred to as collection, with the namespace explain-test.collection.
364-
collection = client["explain-test"]["collection"]
364+
# Workaround for SERVER-108463
365+
names = client["explain-test"].list_collection_names()
366+
if "collection" not in names:
367+
collection = client["explain-test"].create_collection("collection")
368+
else:
369+
collection = client["explain-test"]["collection"]
365370

366371
# Run an explained find on collection. The find will have the query predicate { name: 'john doe' }. Specify a maxTimeMS value of 2000ms for the explain.
367372
with pymongo.timeout(2.0):

0 commit comments

Comments
 (0)