Skip to content

Commit

Permalink
[TEST] Ensure random timestamps are within search boundary
Browse files Browse the repository at this point in the history
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
  • Loading branch information
polyfractal committed Oct 23, 2018
1 parent fd5914e commit 368c6f2
Showing 1 changed file with 3 additions and 2 deletions.
Original file line number Diff line number Diff line change
Expand Up @@ -421,7 +421,6 @@ public void testSimpleDateHistoWithTimeZone() throws Exception {
});
}

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

Expand All @@ -437,7 +436,9 @@ public void testRandomizedDateHisto() throws Exception {
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) -> {
Expand Down

0 comments on commit 368c6f2

Please sign in to comment.