ibessonov commented on code in PR #800:
URL: https://github.com/apache/ignite-3/pull/800#discussion_r871058669


##########
modules/page-memory/src/test/java/org/apache/ignite/internal/pagememory/persistence/checkpoint/CheckpointProgressImplTest.java:
##########
@@ -64,19 +66,22 @@ void testReason() {
 
     @Test
     void testNextCheckpointNanos() {
-        assertThat(new CheckpointProgressImpl(0).nextCheckpointNanos(), 
lessThanOrEqualTo(nanoTime()));
-
-        assertThat(new CheckpointProgressImpl(-1).nextCheckpointNanos(), 
lessThanOrEqualTo(nanoTime()));
-
-        assertThat(new 
CheckpointProgressImpl(Long.MIN_VALUE).nextCheckpointNanos(), 
lessThanOrEqualTo(nanoTime()));
+        assertThat(
+                new CheckpointProgressImpl(0).nextCheckpointNanos(),
+                allOf(greaterThan(0L), lessThanOrEqualTo(nanoTime()))

Review Comment:
   I just realized that these assertions are wrong! Nano time can be negative, 
there's nothing wrong with it. I'm not even sure about proper assertions. When 
it comes to time, things become very tricky.
   You can do the following, for example:
   - long before = nanoTime();
   - long cp = new CheckpointProgressImpl(0).nextCheckpointNanos();
   - long after = nanoTime();
   - assert cp - before >= 0;
   - assert after - cp >= 0;
   
   Assertions for "year" will be different, obviously.



-- 
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.

To unsubscribe, e-mail: [email protected]

For queries about this service, please contact Infrastructure at:
[email protected]

Reply via email to