Skip to content

Commit 0d0c6e4

Browse files
polyfractalChristoph Büscher
authored and
Christoph Büscher
committed
Ensure random timestamps are within search boundary (elastic#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 elastic#34762 "Forward-port" of 368c6f2 (wasn't merged into master for some reason)
1 parent 54c2aec commit 0d0c6e4

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)