reswqa commented on code in PR #22693:
URL: https://github.com/apache/flink/pull/22693#discussion_r1212798930


##########
flink-kubernetes/src/test/java/org/apache/flink/kubernetes/KubernetesResourceManagerDriverTest.java:
##########
@@ -223,6 +225,27 @@ void testFatalHandleError() throws Exception {
         };
     }
 
+    @Test
+    void testKubernetesExceptionHandling() throws Exception {
+        new Context() {
+            {
+                runTest(
+                        () -> {
+                            runInMainThread(
+                                            () -> {
+                                                getDriver()
+                                                        
.requestResource(TASK_EXECUTOR_PROCESS_SPEC)
+                                                        .completeExceptionally(
+                                                                new 
CompletionException(
+                                                                        new 
KubernetesClientException(
+                                                                               
 "test")));
+                                            })
+                                    .get(TIMEOUT_SEC, TimeUnit.SECONDS);

Review Comment:
   nit: It's not very intuitive to assert that the future has not completed 
exceptionally via `.get(TIMEOUT_SEC, TimeUnit.SECONDS)`, how about directly 
using `future assertion`.
   ```
   runTest(
                           () ->
                                   FlinkAssertions.assertThatFuture(
                                                   runInMainThread(
                                                           () -> {
                                                               getDriver()
                                                                       
.requestResource(
                                                                               
TASK_EXECUTOR_PROCESS_SPEC)
                                                                       
.completeExceptionally(
                                                                               
new CompletionException(
                                                                                
       new KubernetesClientException(
                                                                                
               "test")));
                                                           }))
                                           .eventuallySucceeds());
   ```



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