Skip to content

Commit

Permalink
[Segment Replication] Fix flaky testReplicaHasDiffFilesThanPrimary te…
Browse files Browse the repository at this point in the history
…st (#6979)

* [Segment Replication] Fix flaky testReplicaHasDiffFilesThanPrimary test

Signed-off-by: Suraj Singh <[email protected]>

* Use existing doc assertion methods

Signed-off-by: Suraj Singh <[email protected]>

---------

Signed-off-by: Suraj Singh <[email protected]>
  • Loading branch information
dreamer-89 authored Apr 4, 2023
1 parent 5094541 commit 4511354
Showing 1 changed file with 3 additions and 1 deletion.
Original file line number Diff line number Diff line change
Expand Up @@ -737,14 +737,16 @@ public void testReplicaHasDiffFilesThanPrimary() throws Exception {

final SegmentInfos segmentInfos = SegmentInfos.readLatestCommit(replicaShard.store().directory());
replicaShard.finalizeReplication(segmentInfos);
ensureYellow(INDEX_NAME);

final int docCount = scaledRandomIntBetween(10, 200);
for (int i = 0; i < docCount; i++) {
client().prepareIndex(INDEX_NAME).setId(Integer.toString(i)).setSource("field", "value" + i).execute().get();
refresh(INDEX_NAME);
}
// Refresh, this should trigger round of segment replication
assertBusy(() -> { assertDocCounts(docCount, replicaNode); });
waitForSearchableDocs(docCount, primaryNode, replicaNode);
verifyStoreContent();
final IndexShard replicaAfterFailure = getIndexShard(replicaNode, INDEX_NAME);
assertNotEquals(replicaAfterFailure.routingEntry().allocationId().getId(), replicaShard.routingEntry().allocationId().getId());
}
Expand Down

0 comments on commit 4511354

Please sign in to comment.