Skip to content

Commit 368c6f2

Browse files
committed
[TEST] Ensure random timestamps are within search boundary
The random timestamps were landing too close to the current time, so an unlucky rollup interval would round such that the doc wasn't included in the search range (and thus not "rolled up") which would then fail the test. The fix is to make sure the timestamp of all docs is sufficiently behind 'now' that the possible rounding intervals will always include them. Unmutes testRandomizedDateHisto, closes elastic#34762
1 parent fd5914e commit 368c6f2

File tree

1 file changed

+3
-2
lines changed

1 file changed

+3
-2
lines changed

x-pack/plugin/rollup/src/test/java/org/elasticsearch/xpack/rollup/job/RollupIndexerIndexingTests.java

+3-2
Original file line numberDiff line numberDiff line change
@@ -421,7 +421,6 @@ public void testSimpleDateHistoWithTimeZone() throws Exception {
421421
});
422422
}
423423

424-
@AwaitsFix(bugUrl = "https://github.com/elastic/elasticsearch/issues/34762")
425424
public void testRandomizedDateHisto() throws Exception {
426425
String rollupIndex = randomAlphaOfLengthBetween(5, 10);
427426

@@ -437,7 +436,9 @@ public void testRandomizedDateHisto() throws Exception {
437436
final List<Map<String, Object>> dataset = new ArrayList<>();
438437
int numDocs = randomIntBetween(1,100);
439438
for (int i = 0; i < numDocs; i++) {
440-
long timestamp = new DateTime().minusHours(randomIntBetween(1,100)).getMillis();
439+
// Make sure the timestamp is sufficiently in the past that we don't get bitten
440+
// by internal rounding, causing no docs to match
441+
long timestamp = new DateTime().minusDays(2).minusHours(randomIntBetween(11,100)).getMillis();
441442
dataset.add(asMap(timestampField, timestamp, valueField, randomLongBetween(1, 100)));
442443
}
443444
executeTestCase(dataset, job, System.currentTimeMillis(), (resp) -> {

0 commit comments

Comments
 (0)