AHeise commented on a change in pull request #19256:
URL: https://github.com/apache/flink/pull/19256#discussion_r837155577



##########
File path: 
flink-runtime/src/test/java/org/apache/flink/runtime/testutils/CommonTestUtils.java
##########
@@ -359,6 +364,53 @@ public static void waitForSubtasksToFinish(
                 Deadline.fromNow(Duration.of(1, ChronoUnit.MINUTES)));
     }
 
+    /** Wait for at least one successful checkpoint. */
+    public static void waitForCheckpoint(JobID jobID, MiniCluster miniCluster, 
Deadline timeout)
+            throws Exception, FlinkJobNotFoundException {
+        waitUntilCondition(
+                () ->
+                        Optional.ofNullable(
+                                        miniCluster
+                                                .getExecutionGraph(jobID)
+                                                .get()
+                                                .getCheckpointStatsSnapshot())
+                                .filter(st -> 
st.getCounts().getNumberOfCompletedCheckpoints() > 0)
+                                .isPresent(),
+                timeout);
+    }
+
+    /**
+     * @return the path as {@link java.net.URI} to the latest checkpoint.
+     * @throws FlinkJobNotFoundException if job not found
+     * @throws NoSuchElementException if no checkpoint is created yet
+     */
+    public static String getLatestCompletedCheckpointPath(JobID jobID, 
MiniCluster cluster)
+            throws FlinkJobNotFoundException, NoSuchElementException, 
ExecutionException,
+                    InterruptedException {
+        return getLatestCompletedCheckpointPathMaybe(jobID, cluster)
+                .<NoSuchElementException>orElseThrow(
+                        () -> {
+                            throw new NoSuchElementException("No checkpoint 
was created yet");
+                        });
+    }

Review comment:
       I'd remove this method, the Optional one is easy enough to use, which 
I'd rename to `getLatestCompletedCheckpointPath`.




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