Skip to content
Snippets Groups Projects
Commit 826ce1e4 authored by Andrew Chappell's avatar Andrew Chappell
Browse files

Use refresh indices method. No need for deleting index as recreateIndex does that

parent 19eb6500
No related branches found
No related tags found
No related merge requests found
Pipeline #198480 failed
......@@ -58,18 +58,6 @@ class OpenSearchBackendTest extends BackendTestBase {
]);
}
/**
* {@inheritDoc}
*/
public function tearDown(): void {
$server = Server::load($this->serverId);
/** @var \Drupal\search_api_opensearch\Plugin\search_api\backend\OpenSearchBackend $backend */
$backend = $server->getBackend();
$osClient = $backend->getClient();
$osClient->indices()->delete(['index' => $this->prefix . $this->indexId]);
parent::tearDown();
}
/**
* Tests various indexing scenarios for the search backend.
*
......@@ -102,8 +90,7 @@ class OpenSearchBackendTest extends BackendTestBase {
$this->recreateIndex();
$this->insertExampleContent();
$this->indexItems($this->indexId);
// Wait for items to index.
sleep(6);
$this->refreshIndices();
// Check that all our items are indexed both
// by tracker and on server.
......@@ -143,7 +130,7 @@ class OpenSearchBackendTest extends BackendTestBase {
// Re-index the items for next test.
$this->indexItems($this->indexId);
sleep(6);
$this->refreshIndices();
$this->assertEquals(5, $tracker->getIndexedItemsCount());
$result = $this->queryAllResults($osClient);
$this->assertEquals(5, $result['hits']['total']['value']);
......@@ -160,7 +147,7 @@ class OpenSearchBackendTest extends BackendTestBase {
// Re-index the items for next test.
$this->indexItems($this->indexId);
sleep(6);
$this->refreshIndices();
$this->assertEquals(5, $tracker->getIndexedItemsCount());
$result = $this->queryAllResults($osClient);
$this->assertEquals(5, $result['hits']['total']['value']);
......
0% Loading or .
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment