From 2d03df8e3bb9dd527a7880e4d8b27d50ce9b3c36 Mon Sep 17 00:00:00 2001 From: Marc Handalian Date: Fri, 11 Aug 2023 11:21:26 -0700 Subject: [PATCH] Fix flaky test SegmentReplicationIT.testDeleteOperations. (#9244) Signed-off-by: Marc Handalian Signed-off-by: Shivansh Arora --- .../opensearch/indices/replication/SegmentReplicationIT.java | 5 +++-- 1 file changed, 3 insertions(+), 2 deletions(-) diff --git a/server/src/internalClusterTest/java/org/opensearch/indices/replication/SegmentReplicationIT.java b/server/src/internalClusterTest/java/org/opensearch/indices/replication/SegmentReplicationIT.java index b14c59869ccbc..ad6c1491267bd 100644 --- a/server/src/internalClusterTest/java/org/opensearch/indices/replication/SegmentReplicationIT.java +++ b/server/src/internalClusterTest/java/org/opensearch/indices/replication/SegmentReplicationIT.java @@ -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, @@ -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); @@ -641,6 +641,7 @@ public void testDeleteOperations() throws Exception { ensureGreen(INDEX_NAME); Set ids = indexer.getIds(); + assertFalse(ids.isEmpty()); String id = ids.toArray()[0].toString(); client(nodeA).prepareDelete(INDEX_NAME, id).setRefreshPolicy(WriteRequest.RefreshPolicy.IMMEDIATE).get();