From 5646a51f9a35bf2e9d3c25d07d9380b36b4063f2 Mon Sep 17 00:00:00 2001 From: bowenlan-amzn Date: Wed, 14 Feb 2024 15:56:38 -0800 Subject: [PATCH] test: fix flaky for testMinDocCountOnDateHistogram Signed-off-by: bowenlan-amzn --- .../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);