Skip to content

Commit

Permalink
Fix flaky test SegmentReplicationIT.testDeleteOperations. (opensearch…
Browse files Browse the repository at this point in the history
…-project#9244)

Signed-off-by: Marc Handalian <[email protected]>
Signed-off-by: Kaushal Kumar <[email protected]>
  • Loading branch information
mch2 authored and kaushalmahi12 committed Sep 12, 2023
1 parent 3ec7c96 commit 5cfe81d
Showing 1 changed file with 3 additions and 2 deletions.
Original file line number Diff line number Diff line change
Expand Up @@ -615,7 +615,7 @@ public void testDeleteOperations() throws Exception {

createIndex(INDEX_NAME);
ensureGreen(INDEX_NAME);
final int initialDocCount = scaledRandomIntBetween(0, 200);
final int initialDocCount = scaledRandomIntBetween(1, 20);
try (
BackgroundIndexer indexer = new BackgroundIndexer(
INDEX_NAME,
Expand All @@ -632,7 +632,7 @@ public void testDeleteOperations() throws Exception {
refresh(INDEX_NAME);
waitForSearchableDocs(initialDocCount, nodeA, nodeB);

final int additionalDocCount = scaledRandomIntBetween(0, 200);
final int additionalDocCount = scaledRandomIntBetween(0, 20);
final int expectedHitCount = initialDocCount + additionalDocCount;
indexer.start(additionalDocCount);
waitForDocs(expectedHitCount, indexer);
Expand All @@ -641,6 +641,7 @@ public void testDeleteOperations() throws Exception {
ensureGreen(INDEX_NAME);

Set<String> ids = indexer.getIds();
assertFalse(ids.isEmpty());
String id = ids.toArray()[0].toString();
client(nodeA).prepareDelete(INDEX_NAME, id).setRefreshPolicy(WriteRequest.RefreshPolicy.IMMEDIATE).get();

Expand Down

0 comments on commit 5cfe81d

Please sign in to comment.