Skip to content

Commit

Permalink
B2B-1832: Error when reindex Catalog Search index during the snapshot…
Browse files Browse the repository at this point in the history
… of elasticsearch

- unit test fix
  • Loading branch information
Roman Hanin authored and Roman Hanin committed Jun 8, 2021
1 parent b92eac4 commit 9d0c7c5
Show file tree
Hide file tree
Showing 2 changed files with 14 additions and 7 deletions.
Original file line number Diff line number Diff line change
Expand Up @@ -252,7 +252,6 @@ public function cleanIndex($storeId, $mappedIndexerId)
}
} while ($indexExists);


foreach ($deleteQueue as $indexToDelete) {
// remove index if already exists, wildcard deletion may cause collisions
try {
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -336,15 +336,23 @@ public function testCleanIndex()
{
$this->indexNameResolver->expects($this->any())
->method('getIndexName')
->with(1, 'product', [])
->willReturn('indexName_product_1_v');
->willReturnMap([[1, 'product', [1 => null], '_product_1_v0']]);

$this->client->expects($this->atLeastOnce())
$this->client->expects($this->any())
->method('indexExists')
->willReturn(true);
$this->client->expects($this->once())
->willReturnMap(
[
['_product_1_v1', true],
['_product_1_v2', true],
['_product_1_v3', false],
]
);
$this->client->expects($this->exactly(2))
->method('deleteIndex')
->with('_product_1_v1');
->willReturnMap([
['_product_1_v1'],
['_product_1_v2'],
]);
$this->assertSame(
$this->model,
$this->model->cleanIndex(1, 'product')
Expand Down

0 comments on commit 9d0c7c5

Please sign in to comment.