Driver can successfully drop search indexes.
(self)
| 199 | self.assertEqual(index["latestDefinition"], definition) |
| 200 | |
| 201 | def test_case_3(self): |
| 202 | """Driver can successfully drop search indexes.""" |
| 203 | |
| 204 | # Create a collection with the "create" command using a randomly generated name (referred to as ``coll0``). |
| 205 | coll0 = self.db[f"col{uuid.uuid4()}"] |
| 206 | coll0.insert_one({}) |
| 207 | |
| 208 | # Create a new search index on ``coll0``. |
| 209 | model = {"name": _NAME, "definition": {"mappings": {"dynamic": False}}} |
| 210 | resp = coll0.create_search_index(model) |
| 211 | |
| 212 | # Assert that the command returns the name of the index: ``"test-search-index"``. |
| 213 | self.assertEqual(resp, "test-search-index") |
| 214 | |
| 215 | # Run ``coll0.listSearchIndexes()`` repeatedly every 5 seconds until the following condition is satisfied: |
| 216 | # An index with the ``name`` of ``test-search-index`` is present and index has a field ``queryable`` with the value of ``true``. |
| 217 | self.wait_for_ready(coll0) |
| 218 | |
| 219 | # Run a ``dropSearchIndex`` on ``coll0``, using ``test-search-index`` for the name. |
| 220 | coll0.drop_search_index(_NAME) |
| 221 | |
| 222 | # Run ``coll0.listSearchIndexes()`` repeatedly every 5 seconds until ``listSearchIndexes`` returns an empty array. |
| 223 | t0 = time.time() |
| 224 | while True: |
| 225 | indices = (coll0.list_search_indexes()).to_list() |
| 226 | if indices: |
| 227 | break |
| 228 | if (time.time() - t0) / 60 > 5: |
| 229 | raise TimeoutError("Timed out waiting for index deletion") |
| 230 | time.sleep(5) |
| 231 | |
| 232 | def test_case_4(self): |
| 233 | """Driver can update a search index.""" |
nothing calls this directly
no test coverage detected