From 34b21af869537f62b71bf297f78e766afbe37eac Mon Sep 17 00:00:00 2001 From: Jay Deng Date: Thu, 5 Oct 2023 17:21:35 -0700 Subject: [PATCH] Avoid size=0 for terminate_after tests Signed-off-by: Jay Deng --- .../java/org/opensearch/search/simple/SimpleSearchIT.java | 8 +++++--- 1 file changed, 5 insertions(+), 3 deletions(-) diff --git a/server/src/internalClusterTest/java/org/opensearch/search/simple/SimpleSearchIT.java b/server/src/internalClusterTest/java/org/opensearch/search/simple/SimpleSearchIT.java index 95b36311f6b8b..7c2ae49eeba4e 100644 --- a/server/src/internalClusterTest/java/org/opensearch/search/simple/SimpleSearchIT.java +++ b/server/src/internalClusterTest/java/org/opensearch/search/simple/SimpleSearchIT.java @@ -301,7 +301,8 @@ public void testSimpleTerminateAfterCount() throws Exception { SearchResponse searchResponse; int size; for (int i = 1; i < max; i++) { - size = randomIntBetween(0, max); + // Size=0 has known issues, see https://github.com/opensearch-project/OpenSearch/issues/10435 + size = randomIntBetween(1, max); searchResponse = client().prepareSearch("test") .setQuery(QueryBuilders.rangeQuery("field").gte(1).lte(max)) .setTerminateAfter(i) @@ -337,8 +338,9 @@ public void testSimpleTerminateAfterTrackTotalHitsUpTo() throws Exception { ensureGreen(); refresh(); - // size=0 is a special case where topDocsCollector is not added - int size = randomIntBetween(0, 1); + // Size=0 is a special case where topDocsCollector is not added + // Size=0 has known issues, see https://github.com/opensearch-project/OpenSearch/issues/10435 + int size = 1; SearchResponse searchResponse; searchResponse = client().prepareSearch("test") .setQuery(QueryBuilders.rangeQuery("field").gte(1).lte(numDocs))