Skip to content
Open
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
9 changes: 9 additions & 0 deletions test/asynchronous/test_index_management.py
Original file line number Diff line number Diff line change
Expand Up @@ -27,6 +27,8 @@

import pytest

from test.asynchronous.utils import flaky

sys.path[0:0] = [""]

from pymongo.errors import OperationFailure
Expand Down Expand Up @@ -138,6 +140,7 @@ async def test_comment_field(self):
class TestSearchIndexProse(SearchIndexIntegrationBase):
db_name = "test_search_index_prose"

@flaky(reason="PYTHON-6056", affects_cpython_linux=True)
async def test_case_1(self):
"""Driver can successfully create and list search indexes."""

Expand All @@ -156,6 +159,7 @@ async def test_case_1(self):
self.assertIn("latestDefinition", index)
self.assertEqual(index["latestDefinition"], model["definition"])

@flaky(reason="PYTHON-6056", affects_cpython_linux=True)
async def test_case_2(self):
"""Driver can successfully create multiple indexes in batch."""

Expand Down Expand Up @@ -188,6 +192,7 @@ async def test_case_2(self):
self.assertIn("latestDefinition", index)
self.assertEqual(index["latestDefinition"], definition)

@flaky(reason="PYTHON-6056", affects_cpython_linux=True)
async def test_case_3(self):
"""Driver can successfully drop search indexes."""

Expand Down Expand Up @@ -215,6 +220,7 @@ async def test_case_3(self):
raise TimeoutError("Timed out waiting for index deletion")
await asyncio.sleep(5)

@flaky(reason="PYTHON-6056", affects_cpython_linux=True)
async def test_case_4(self):
"""Driver can update a search index."""

Expand Down Expand Up @@ -245,6 +251,7 @@ async def test_case_4(self):
self.assertIn("latestDefinition", index)
self.assertEqual(index["latestDefinition"], model2["definition"])

@flaky(reason="PYTHON-6056", affects_cpython_linux=True)
async def test_case_5(self):
"""``dropSearchIndex`` suppresses namespace not found errors."""
# Create a driver-side collection object for a randomly generated collection name. Do not create this collection on the server.
Expand All @@ -253,6 +260,7 @@ async def test_case_5(self):
# Run a ``dropSearchIndex`` command and assert that no error is thrown.
await coll0.drop_search_index("foo")

@flaky(reason="PYTHON-6056", affects_cpython_linux=True)
async def test_case_6(self):
"""Driver can successfully create and list search indexes with non-default readConcern and writeConcern."""

Expand All @@ -277,6 +285,7 @@ async def test_case_6(self):
self.assertIn("latestDefinition", index)
self.assertEqual(index["latestDefinition"], model["definition"])

@flaky(reason="PYTHON-6056", affects_cpython_linux=True)
async def test_case_7(self):
"""Driver handles index types."""

Expand Down
9 changes: 9 additions & 0 deletions test/test_index_management.py
Original file line number Diff line number Diff line change
Expand Up @@ -27,6 +27,8 @@

import pytest

from test.utils import flaky

sys.path[0:0] = [""]

from pymongo.errors import OperationFailure
Expand Down Expand Up @@ -136,6 +138,7 @@ def test_comment_field(self):
class TestSearchIndexProse(SearchIndexIntegrationBase):
db_name = "test_search_index_prose"

@flaky(reason="PYTHON-6056", affects_cpython_linux=True)
def test_case_1(self):
"""Driver can successfully create and list search indexes."""

Expand All @@ -154,6 +157,7 @@ def test_case_1(self):
self.assertIn("latestDefinition", index)
self.assertEqual(index["latestDefinition"], model["definition"])

@flaky(reason="PYTHON-6056", affects_cpython_linux=True)
def test_case_2(self):
"""Driver can successfully create multiple indexes in batch."""

Expand Down Expand Up @@ -186,6 +190,7 @@ def test_case_2(self):
self.assertIn("latestDefinition", index)
self.assertEqual(index["latestDefinition"], definition)

@flaky(reason="PYTHON-6056", affects_cpython_linux=True)
def test_case_3(self):
"""Driver can successfully drop search indexes."""

Expand Down Expand Up @@ -213,6 +218,7 @@ def test_case_3(self):
raise TimeoutError("Timed out waiting for index deletion")
time.sleep(5)

@flaky(reason="PYTHON-6056", affects_cpython_linux=True)
def test_case_4(self):
"""Driver can update a search index."""

Expand Down Expand Up @@ -243,6 +249,7 @@ def test_case_4(self):
self.assertIn("latestDefinition", index)
self.assertEqual(index["latestDefinition"], model2["definition"])

@flaky(reason="PYTHON-6056", affects_cpython_linux=True)
def test_case_5(self):
"""``dropSearchIndex`` suppresses namespace not found errors."""
# Create a driver-side collection object for a randomly generated collection name. Do not create this collection on the server.
Expand All @@ -251,6 +258,7 @@ def test_case_5(self):
# Run a ``dropSearchIndex`` command and assert that no error is thrown.
coll0.drop_search_index("foo")

@flaky(reason="PYTHON-6056", affects_cpython_linux=True)
def test_case_6(self):
"""Driver can successfully create and list search indexes with non-default readConcern and writeConcern."""

Expand All @@ -275,6 +283,7 @@ def test_case_6(self):
self.assertIn("latestDefinition", index)
self.assertEqual(index["latestDefinition"], model["definition"])

@flaky(reason="PYTHON-6056", affects_cpython_linux=True)
def test_case_7(self):
"""Driver handles index types."""

Expand Down
Loading