Skip to content

Commit

Permalink
test: fix flaky for testMinDocCountOnDateHistogram
Browse files Browse the repository at this point in the history
Signed-off-by: bowenlan-amzn <[email protected]>
  • Loading branch information
bowenlan-amzn committed Feb 14, 2024
1 parent 84750b3 commit 5646a51
Showing 1 changed file with 6 additions and 6 deletions.
Original file line number Diff line number Diff line change
Expand Up @@ -59,19 +59,19 @@ public static Collection<Object[]> parameters() {
@Override
protected void setupSuiteScopeCluster() throws Exception {
assertAcked(client().admin().indices().prepareCreate("idx").get());
expected.clear();

final int segmentCount = randomIntBetween(2, 10);
final Set<Long> longTerms = new HashSet();
final int repeat = randomIntBetween(2, 10);
final Set<Long> longTerms = new HashSet<>();

final Map<String, Integer> dateTerms = new HashMap<>();
for (int i = 0; i < segmentCount; i++) {
for (int i = 0; i < repeat; i++) {
final List<IndexRequestBuilder> 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);
Expand Down

0 comments on commit 5646a51

Please sign in to comment.