Skip to content

Commit da2681e

Browse files
author
Hendrik Muhs
authored
[Transform] fix time rounding in TransformContinuousIT (#63113)
fix a time rounding problem in the test, due to rounding down to epoch seconds instead of epoch millis fixes #62951
1 parent 68b0449 commit da2681e

File tree

1 file changed

+8
-4
lines changed
  • x-pack/plugin/transform/qa/single-node-tests/src/javaRestTest/java/org/elasticsearch/xpack/transform/integration/continuous

1 file changed

+8
-4
lines changed

x-pack/plugin/transform/qa/single-node-tests/src/javaRestTest/java/org/elasticsearch/xpack/transform/integration/continuous/TransformContinuousIT.java

Lines changed: 8 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -237,7 +237,10 @@ public void testContinousEvents() throws Exception {
237237

238238
// start all transforms, wait until the processed all data and stop them
239239
startTransforms();
240-
waitUntilTransformsReachedUpperBound(runDate.getEpochSecond() * 1000 + 1);
240+
241+
// at random we added between 0 and 999_999ns == (1ms - 1ns) to every data point, so we add 1ms, so every data point is before
242+
// the checkpoint
243+
waitUntilTransformsReachedUpperBound(runDate.toEpochMilli() + 1, run);
241244
stopTransforms();
242245

243246
// TODO: the transform dest index requires a refresh, see gh#51154
@@ -387,11 +390,12 @@ private GetTransformStatsResponse getTransformStats(String id) throws IOExceptio
387390
}
388391
}
389392

390-
private void waitUntilTransformsReachedUpperBound(long timeStampUpperBoundMillis) throws Exception {
393+
private void waitUntilTransformsReachedUpperBound(long timeStampUpperBoundMillis, int iteration) throws Exception {
391394
logger.info(
392-
"wait until transform reaches timestamp_millis: {}",
395+
"wait until transform reaches timestamp_millis: {} iteration: {}",
393396
ContinuousTestCase.STRICT_DATE_OPTIONAL_TIME_PRINTER_NANOS.withZone(ZoneId.of("UTC"))
394-
.format(Instant.ofEpochMilli(timeStampUpperBoundMillis))
397+
.format(Instant.ofEpochMilli(timeStampUpperBoundMillis)),
398+
iteration
395399
);
396400
for (ContinuousTestCase testCase : transformTestCases) {
397401
assertBusy(() -> {

0 commit comments

Comments
 (0)