hlteoh37 commented on code in PR #23949:
URL: https://github.com/apache/flink/pull/23949#discussion_r1431138471


##########
flink-runtime/src/test/java/org/apache/flink/runtime/dispatcher/DispatcherTest.java:
##########
@@ -683,6 +685,129 @@ public void testRetrieveCheckpointStats() throws 
Exception {
         Assertions.assertThat(resultsFuture).isCompletedWithValue(snapshot);
     }
 
+    @Test
+    public void testRetrieveCheckpointStatsOnFailedJob() throws Exception {
+        CheckpointStatsSnapshot snapshot = 
getTestCheckpointStatsSnapshotWithTwoFailedCheckpoints();
+        TestingJobMasterGateway testingJobMasterGateway =
+                new TestingJobMasterGatewayBuilder().build();
+
+        dispatcher =
+                createAndStartDispatcher(
+                        heartbeatServices,
+                        haServices,
+                        new TestingJobMasterGatewayJobManagerRunnerFactory(
+                                testingJobMasterGateway));
+
+        final JobStatus jobStatus = JobStatus.FAILED;
+        final ExecutionGraphInfo completedExecutionGraphInfo =
+                new ExecutionGraphInfo(
+                        new ArchivedExecutionGraphBuilder()
+                                .setJobID(jobId)
+                                .setState(jobStatus)
+                                .setFailureCause(
+                                        new ErrorInfo(new 
RuntimeException("expected"), 1L))
+                                .setCheckpointStatsSnapshot(snapshot)
+                                .build());
+        dispatcher.completeJobExecution(completedExecutionGraphInfo);
+
+        CompletableFuture<CheckpointStatsSnapshot> resultsFuture =
+                dispatcher.callAsyncInMainThread(
+                        () -> dispatcher.requestCheckpointStats(jobId, 
TIMEOUT));
+        
Assertions.assertThat(resultsFuture).succeedsWithin(Duration.ofSeconds(1));
+        Assertions.assertThat(resultsFuture).isCompletedWithValue(snapshot);
+    }

Review Comment:
   done.



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