AHeise commented on a change in pull request #10931: [FLINK-15603][metrics] Add
checkpointStartDelay metric
URL: https://github.com/apache/flink/pull/10931#discussion_r369992272
##########
File path:
flink-streaming-java/src/test/java/org/apache/flink/streaming/runtime/io/CheckpointBarrierAlignerTestBase.java
##########
@@ -1254,9 +1264,15 @@ private static void check(BufferOrEvent expected,
BufferOrEvent present, int pag
}
}
- private static void validateAlignmentTime(long startTimestamp, long
alignmentDuration) {
- final long elapsed = System.nanoTime() - startTimestamp;
- assertTrue("wrong alignment time", alignmentDuration <=
elapsed);
+ private static void validateAlignmentTime(long alignmentStartTimestamp,
CheckpointedInputGate inputGate) {
+ long elapsedAlignment = System.nanoTime() -
alignmentStartTimestamp;
+ long elapsedTotalTime = System.nanoTime() - testStartTimeNanos;
+ assertThat(inputGate.getAlignmentDurationNanos(),
Matchers.lessThanOrEqualTo(elapsedAlignment));
+
+ // Barrier lag is calculated with System.currentTimeMillis(),
so we need a tolerance of 1ms
+ // when comparing to time elapsed via System.nanoTime()
+ long tolerance = 1_000_000;
Review comment:
exactly the reason why I would only use ms.
----------------------------------------------------------------
This is an automated message from the Apache Git Service.
To respond to the message, please log on to GitHub and use the
URL above to go to the specific comment.
For queries about this service, please contact Infrastructure at:
[email protected]
With regards,
Apache Git Services