Skip to content
Merged
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
20 changes: 20 additions & 0 deletions test/asynchronous/test_index_management.py
Original file line number Diff line number Diff line change
Expand Up @@ -406,6 +406,26 @@ async def test_case_7(self):
)
self.assertIn("Attribute mappings missing.", e.exception.details["errmsg"])

@flaky(reason="PYTHON-6056", affects_cpython_linux=True)
async def test_case_9(self):
"""Drivers use server default for unspecified name ("default") and type ("search")."""
# Create a new search index on ``self.coll0`` without specifying the name or type.
model = {"definition": {"mappings": {"dynamic": True}}}
resp = await self.coll0.create_search_index(model)
self.addAsyncCleanup(self.drop_and_wait, self.coll0, "default")

# Assert that the command returns the name of the index: ``"default"``.
self.assertEqual(resp, "default")

# Run ``self.coll0.listSearchIndexes()`` repeatedly every 5 seconds until the following
# condition is satisfied and store the value in a variable ``index``:
# An index with the ``name`` of ``default`` is present and the index has a field
# ``queryable`` with a value of ``true``.
index = await self.wait_for_ready(self.coll0, "default")

# Assert that ``index`` has a property ``type`` whose value is ``search``.
self.assertEqual(index["type"], "search")


globals().update(
generate_test_classes(
Expand Down
20 changes: 20 additions & 0 deletions test/test_index_management.py
Original file line number Diff line number Diff line change
Expand Up @@ -404,6 +404,26 @@ def test_case_7(self):
)
self.assertIn("Attribute mappings missing.", e.exception.details["errmsg"])

@flaky(reason="PYTHON-6056", affects_cpython_linux=True)
def test_case_9(self):
"""Drivers use server default for unspecified name ("default") and type ("search")."""
# Create a new search index on ``self.coll0`` without specifying the name or type.
model = {"definition": {"mappings": {"dynamic": True}}}
resp = self.coll0.create_search_index(model)
self.addCleanup(self.drop_and_wait, self.coll0, "default")

# Assert that the command returns the name of the index: ``"default"``.
self.assertEqual(resp, "default")

# Run ``self.coll0.listSearchIndexes()`` repeatedly every 5 seconds until the following
# condition is satisfied and store the value in a variable ``index``:
# An index with the ``name`` of ``default`` is present and the index has a field
# ``queryable`` with a value of ``true``.
index = self.wait_for_ready(self.coll0, "default")

# Assert that ``index`` has a property ``type`` whose value is ``search``.
self.assertEqual(index["type"], "search")


globals().update(
generate_test_classes(
Expand Down
Loading