You are viewing a plain text version of this content. The canonical link for it is here.
Posted to issues@flink.apache.org by "TanYuxin-tyx (via GitHub)" <gi...@apache.org> on 2023/04/24 06:44:41 UTC

[GitHub] [flink] TanYuxin-tyx commented on a diff in pull request #22471: [FLINK-31897] Fix the unstable test ClientTest#testRequestUnavailableHost

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


##########
flink-queryable-state/flink-queryable-state-runtime/src/test/java/org/apache/flink/queryablestate/network/ClientTest.java:
##########
@@ -721,29 +740,34 @@ public void testClientServerIntegration() throws Throwable {
             } catch (Exception e) {
                 e.printStackTrace();
             }
-            Assert.assertTrue(client.isEventGroupShutdown());
-
-            final CombinableMatcher<Throwable> exceptionMatcher =
-                    either(FlinkMatchers.containsCause(ClosedChannelException.class))
-                            .or(FlinkMatchers.containsCause(IllegalStateException.class));
+            assertThat(client.isEventGroupShutdown()).isTrue();
 
             for (Future<Void> future : taskFutures) {
                 try {
                     future.get();
-                    fail("Did not throw expected Exception after shut down");
-                } catch (ExecutionException t) {
-                    assertThat(t, exceptionMatcher);
+                } catch (Throwable throwable) {
+                    assertThat(
+                                    ExceptionUtils.findThrowable(
+                                                            throwable, ClosedChannelException.class)
+                                                    .isPresent()
+                                            || ExceptionUtils.findThrowable(
+                                                            throwable, IllegalStateException.class)
+                                                    .isPresent())
+                            .isTrue();

Review Comment:
   I have used `assertThat` 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: issues-unsubscribe@flink.apache.org

For queries about this service, please contact Infrastructure at:
users@infra.apache.org