From 96e979c3e232b1bb3d0ac1c47ad6859c2840deb3 Mon Sep 17 00:00:00 2001 From: "github-actions[bot]" Date: Thu, 15 Feb 2024 17:44:42 +0000 Subject: [PATCH] Fix test logic error in FilterRewriteIT (#12327) Signed-off-by: bowenlan-amzn (cherry picked from commit 03e415e8956dbc63b014f6b49c10650d353c90ca) Signed-off-by: github-actions[bot] --- .../search/aggregations/bucket/FilterRewriteIT.java | 12 ++++++------ 1 file changed, 6 insertions(+), 6 deletions(-) diff --git a/server/src/internalClusterTest/java/org/opensearch/search/aggregations/bucket/FilterRewriteIT.java b/server/src/internalClusterTest/java/org/opensearch/search/aggregations/bucket/FilterRewriteIT.java index 35e024603f0f2..e051265d4b3bc 100644 --- a/server/src/internalClusterTest/java/org/opensearch/search/aggregations/bucket/FilterRewriteIT.java +++ b/server/src/internalClusterTest/java/org/opensearch/search/aggregations/bucket/FilterRewriteIT.java @@ -59,19 +59,19 @@ public static Collection parameters() { @Override protected void setupSuiteScopeCluster() throws Exception { assertAcked(client().admin().indices().prepareCreate("idx").get()); + expected.clear(); - final int segmentCount = randomIntBetween(2, 10); - final Set longTerms = new HashSet(); + final int repeat = randomIntBetween(2, 10); + final Set longTerms = new HashSet<>(); - final Map dateTerms = new HashMap<>(); - for (int i = 0; i < segmentCount; i++) { + for (int i = 0; i < repeat; i++) { final List indexRequests = new ArrayList<>(); long longTerm; do { - longTerm = randomInt(segmentCount * 2); + longTerm = randomInt(repeat * 2); } while (!longTerms.add(longTerm)); - ZonedDateTime time = ZonedDateTime.of(2024, 1, ((int) longTerm % 20) + 1, 0, 0, 0, 0, ZoneOffset.UTC); + ZonedDateTime time = ZonedDateTime.of(2024, 1, ((int) longTerm) + 1, 0, 0, 0, 0, ZoneOffset.UTC); String dateTerm = DateFormatter.forPattern("yyyy-MM-dd").format(time); final int frequency = randomBoolean() ? 1 : randomIntBetween(2, 20);