Skip to content

Commit 34b41bb

Browse files
committed
MAGE-1044 Verify replica index to sort attribute parity for sync command
1 parent d69759c commit 34b41bb

File tree

1 file changed

+10
-2
lines changed

1 file changed

+10
-2
lines changed

Test/Integration/Product/ReplicaIndexingTest.php

Lines changed: 10 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -139,7 +139,7 @@ public function testVirtualReplicaConfig(): void
139139
}
140140

141141
/**
142-
* ConfigHelper::setSorting used WriterInterface which does not update unless DB isolation is disabled
142+
* ConfigHelper::setSorting uses WriterInterface which does not update unless DB isolation is disabled
143143
* This provides a workaround to test using MutableScopeConfigInterface with DB isolation enabled
144144
*/
145145
protected function mockSortUpdate(string $sortAttr, string $sortDir, array $attr): void
@@ -201,7 +201,15 @@ public function testReplicaSync(): void
201201
$this->assertArrayHasKey('replicas', $currentSettings);
202202
$replicas = $currentSettings['replicas'];
203203

204-
$this->assertTrue(count($replicas) >= count($sorting));
204+
$this->assertEquals(count($sorting), count($replicas));
205+
206+
foreach ($sorting as $sortAttr) {
207+
$replicaIndexName = $sortAttr['name'];
208+
$needle = array_key_exists('virtualReplica', $sortAttr) && $sortAttr['virtualReplica']
209+
? "virtual($replicaIndexName)"
210+
: $replicaIndexName;
211+
$this->assertContains($needle, $replicas);
212+
}
205213

206214
}
207215

0 commit comments

Comments
 (0)