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.
This commit is contained in:
Christoph Büscher 2019-10-10 14:38:01 +02:00 committed by GitHub
parent c1f30e34ff
commit f07de06cdd
No known key found for this signature in database
GPG Key ID: 4AEE18F83AFDEB23
1 changed files with 3 additions and 2 deletions

View File

@ -452,7 +452,6 @@ public class RollupIndexerIndexingTests extends AggregatorTestCase {
});
}
@AwaitsFix(bugUrl = "https://github.com/elastic/elasticsearch/issues/34762")
public void testRandomizedDateHisto() throws Exception {
String rollupIndex = randomAlphaOfLengthBetween(5, 10);
@ -468,7 +467,9 @@ public class RollupIndexerIndexingTests extends AggregatorTestCase {
final List<Map<String, Object>> dataset = new ArrayList<>();
int numDocs = randomIntBetween(1,100);
for (int i = 0; i < numDocs; i++) {
long timestamp = new DateTime().minusHours(randomIntBetween(1,100)).getMillis();
// Make sure the timestamp is sufficiently in the past that we don't get bitten
// by internal rounding, causing no docs to match
long timestamp = new DateTime().minusDays(2).minusHours(randomIntBetween(11,100)).getMillis();
dataset.add(asMap(timestampField, timestamp, valueField, randomLongBetween(1, 100)));
}
executeTestCase(dataset, job, System.currentTimeMillis(), (resp) -> {