Skip to content

Commit 061c1fe

Browse files
authored
Ensure random timestamps are within search boundary (#38753)
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 #34762 "Forward-port" of 368c6f2 (wasn't merged into master for some reason)
1 parent 296febb commit 061c1fe

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
@@ -397,7 +397,6 @@ public void testSimpleDateHistoWithTimeZone() throws Exception {
397397
});
398398
}
399399

400-
@AwaitsFix(bugUrl = "https://github.com/elastic/elasticsearch/issues/34762")
401400
public void testRandomizedDateHisto() throws Exception {
402401
String rollupIndex = randomAlphaOfLengthBetween(5, 10);
403402

@@ -413,7 +412,9 @@ public void testRandomizedDateHisto() throws Exception {
413412
final List<Map<String, Object>> dataset = new ArrayList<>();
414413
int numDocs = randomIntBetween(1,100);
415414
for (int i = 0; i < numDocs; i++) {
416-
long timestamp = new DateTime().minusHours(randomIntBetween(1,100)).getMillis();
415+
// Make sure the timestamp is sufficiently in the past that we don't get bitten
416+
// by internal rounding, causing no docs to match
417+
long timestamp = new DateTime().minusDays(2).minusHours(randomIntBetween(11,100)).getMillis();
417418
dataset.add(asMap(timestampField, timestamp, valueField, randomLongBetween(1, 100)));
418419
}
419420
executeTestCase(dataset, job, System.currentTimeMillis(), (resp) -> {

0 commit comments

Comments
 (0)