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


##########
modules/page-memory/src/test/java/org/apache/ignite/internal/pagememory/persistence/checkpoint/CheckpointerTest.java:
##########
@@ -100,43 +107,56 @@ void testStartAndStop() throws Exception {
 
     @Test
     void testScheduleCheckpoint() {
-        Checkpointer checkpointer = new Checkpointer(
+        Checkpointer checkpointer = spy(new Checkpointer(
                 log,
                 "test",
                 null,
                 null,
                 mock(CheckpointWorkflow.class),
                 mock(CheckpointPagesWriterFactory.class),
                 1,
-                () -> 1_000
-        );
+                () -> 1_000,
+                () -> 0
+        ));
 
         assertNull(checkpointer.currentProgress());
 
         CheckpointProgressImpl scheduledProgress = (CheckpointProgressImpl) 
checkpointer.scheduledProgress();
 
-        long nextCheckpointDelayNanos = 
scheduledProgress.nextCheckpointDelayNanos();
-        String reason = scheduledProgress.reason();
+        long nextCheckpointNanosOnCreateCheckpointer = 
scheduledProgress.nextCheckpointNanos();
+        String reasonOnCreateCheckpointer = scheduledProgress.reason();
 
         assertThat(
-                nextCheckpointDelayNanos,
-                allOf(greaterThanOrEqualTo(MILLISECONDS.toNanos(995)), 
lessThanOrEqualTo(MILLISECONDS.toNanos(1005)))
+                nextCheckpointNanosOnCreateCheckpointer - nanoTime(),
+                allOf(greaterThan(0L), 
lessThanOrEqualTo(MILLISECONDS.toNanos(1_000)))
         );
 
+        assertNull(reasonOnCreateCheckpointer);
+
         assertSame(scheduledProgress, checkpointer.scheduleCheckpoint(3000, 
"test0"));
 
         assertNull(checkpointer.currentProgress());
 
-        assertEquals(nextCheckpointDelayNanos, 
scheduledProgress.nextCheckpointDelayNanos());
-        assertEquals(reason, scheduledProgress.reason());
+        assertEquals(nextCheckpointNanosOnCreateCheckpointer, 
scheduledProgress.nextCheckpointNanos());
+        assertEquals(reasonOnCreateCheckpointer, scheduledProgress.reason());
 
         assertSame(scheduledProgress, checkpointer.scheduleCheckpoint(100, 
"test1"));
 
         assertNull(checkpointer.currentProgress());
 
-        assertEquals(MILLISECONDS.toNanos(100), 
scheduledProgress.nextCheckpointDelayNanos());
+        assertNotEquals(nextCheckpointNanosOnCreateCheckpointer, 
scheduledProgress.nextCheckpointNanos());
+        assertNotEquals(reasonOnCreateCheckpointer, 
scheduledProgress.reason());
+
+        assertThat(
+                scheduledProgress.nextCheckpointNanos() - nanoTime(),
+                allOf(greaterThan(0L), 
lessThanOrEqualTo(MILLISECONDS.toNanos(100)))
+        );
+
         assertEquals("test1", scheduledProgress.reason());
 
+        long nextCheckpointNanosSchedule100Mills = 
scheduledProgress.nextCheckpointNanos();
+        String reasonSchedule100Mills = scheduledProgress.reason();

Review Comment:
   Strange name for the variable



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