TanYuxin-tyx commented on code in PR #22471:
URL: https://github.com/apache/flink/pull/22471#discussion_r1174849327


##########
flink-queryable-state/flink-queryable-state-runtime/src/test/java/org/apache/flink/queryablestate/network/ClientTest.java:
##########
@@ -506,49 +525,49 @@ public void testServerClosesChannel() throws Exception {
             // Requests
             KvStateInternalRequest request =
                     new KvStateInternalRequest(new KvStateID(), new byte[0]);
-            Future<KvStateResponse> future = client.sendRequest(serverAddress, 
request);
+            CompletableFuture<KvStateResponse> future = 
client.sendRequest(serverAddress, request);
 
             received.take();
 
-            assertEquals(1, stats.getNumConnections());
+            assertThat(stats.getNumConnections()).isEqualTo(1);
 
             channel.get().close().await();
 
             try {
+                assertThatFuture(future).eventuallyFails();
                 future.get();
-                fail("Did not throw expected server failure");
             } catch (ExecutionException e) {
-                if (!(e.getCause() instanceof ClosedChannelException)) {
-                    fail("Did not throw expected Exception");
-                }
+                assertThat(e.getCause())
+                        .withFailMessage("Did not throw expected Exception")
+                        .isInstanceOf(ClosedChannelException.class);

Review Comment:
   Use `FlinkAssertions.assertThatFuture(future)` instead.



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