XComp commented on a change in pull request #17967:
URL: https://github.com/apache/flink/pull/17967#discussion_r760955620



##########
File path: 
flink-runtime/src/test/java/org/apache/flink/runtime/jobmaster/DefaultJobMasterServiceProcessTest.java
##########
@@ -70,6 +78,69 @@ public void testInitializationFailureCompletesResultFuture() 
{
         assertThat(initializationFailure, containsCause(originalCause));
     }
 
+    @Test
+    public void testInitializationFailureSetsFailureInfoProperly()
+            throws ExecutionException, InterruptedException {
+        final CompletableFuture<JobMasterService> jobMasterServiceFuture =
+                new CompletableFuture<>();
+        DefaultJobMasterServiceProcess serviceProcess = 
createTestInstance(jobMasterServiceFuture);
+        final RuntimeException originalCause = new RuntimeException("Expected 
RuntimeException");
+
+        long beforeFailureTimestamp = System.currentTimeMillis();
+        jobMasterServiceFuture.completeExceptionally(originalCause);
+        long afterFailureTimestamp = System.currentTimeMillis();
+
+        final JobManagerRunnerResult result = 
serviceProcess.getResultFuture().get();
+        final ErrorInfo executionGraphFailure =
+                
result.getExecutionGraphInfo().getArchivedExecutionGraph().getFailureInfo();
+
+        assertNotNull(executionGraphFailure);
+        final Throwable actualException =
+                executionGraphFailure
+                        .getException()
+                        
.deserializeError(Thread.currentThread().getContextClassLoader());
+        assertEquals(JobInitializationException.class, 
actualException.getClass());
+        assertTrue(
+                ExceptionUtils.findThrowable(actualException, t -> 
t.equals(originalCause))
+                        .isPresent());
+
+        assertTrue(executionGraphFailure.getTimestamp() >= 
beforeFailureTimestamp);
+        assertTrue(executionGraphFailure.getTimestamp() <= 
afterFailureTimestamp);
+    }
+
+    @Test
+    public void testInitializationFailureSetsExceptionHistoryProperly()

Review comment:
       Good point, I moved the assertions into a helper method. 👍 




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