zhuzhurk commented on a change in pull request #10553: [FLINK-11524][tests] 
Throw descriptive error if job terminates prematurely
URL: https://github.com/apache/flink/pull/10553#discussion_r361057539
 
 

 ##########
 File path: 
flink-runtime/src/test/java/org/apache/flink/runtime/jobmaster/utils/JobResultUtils.java
 ##########
 @@ -32,4 +37,23 @@ public static void assertSuccess(final JobResult result) {
                        }
                }
        }
+
+       public static void assertIncomplete(final CompletableFuture<JobResult> 
result) {
+               if (result.isDone()) {
+                       final JobResult jobResult;
+                       try {
+                               jobResult = result.get();
+                       } catch (InterruptedException | ExecutionException e) {
+                               // we already know it is done so this doesn't 
happen
+                               throw new AssertionError("Unexpected exception 
when processing finished future.", e);
+                       }
+
+                       if (jobResult.isSuccess()) {
+                               throw new AssertionError("Job finished 
successfully.");
+                       } else {
+                               // this is guarantee to fail with an error
+                               assertSuccess(jobResult);
 
 Review comment:
   Addedd `JobResultUtils#throwAssertionErrorOnFailedResult` for this purpose 
in another commit f523e291218ebbcd66632cb88c962ea22a2b3355.

----------------------------------------------------------------
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.
 
For queries about this service, please contact Infrastructure at:
[email protected]


With regards,
Apache Git Services

Reply via email to