Skip to content

Commit f07de06

Browse files
author
Christoph Büscher
authored
Ensure random timestamps are within search boundary (#38753) (#47787)
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. Backport of #38753 to 7.x where the test was still muted.
1 parent c1f30e3 commit f07de06

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
@@ -452,7 +452,6 @@ public void testSimpleDateHistoWithTimeZone() throws Exception {
452452
});
453453
}
454454

455-
@AwaitsFix(bugUrl = "https://github.com/elastic/elasticsearch/issues/34762")
456455
public void testRandomizedDateHisto() throws Exception {
457456
String rollupIndex = randomAlphaOfLengthBetween(5, 10);
458457

@@ -468,7 +467,9 @@ public void testRandomizedDateHisto() throws Exception {
468467
final List<Map<String, Object>> dataset = new ArrayList<>();
469468
int numDocs = randomIntBetween(1,100);
470469
for (int i = 0; i < numDocs; i++) {
471-
long timestamp = new DateTime().minusHours(randomIntBetween(1,100)).getMillis();
470+
// Make sure the timestamp is sufficiently in the past that we don't get bitten
471+
// by internal rounding, causing no docs to match
472+
long timestamp = new DateTime().minusDays(2).minusHours(randomIntBetween(11,100)).getMillis();
472473
dataset.add(asMap(timestampField, timestamp, valueField, randomLongBetween(1, 100)));
473474
}
474475
executeTestCase(dataset, job, System.currentTimeMillis(), (resp) -> {

0 commit comments

Comments
 (0)