You are viewing a plain text version of this content. The canonical link for it is here.
Posted to issues@flink.apache.org by GitBox <gi...@apache.org> on 2022/05/02 13:04:49 UTC

[GitHub] [flink] RocMarshal commented on a diff in pull request #18986: [FLINK-26496][flink-yarn-test] [JUnit5 Migration] Module: flink-yarn-test

RocMarshal commented on code in PR #18986:
URL: https://github.com/apache/flink/pull/18986#discussion_r862826136


##########
flink-yarn-tests/src/test/java/org/apache/flink/yarn/YARNSessionCapacitySchedulerITCase.java:
##########
@@ -445,39 +444,51 @@ private static Map<String, String> getFlinkConfig(final String host, final int p
      * With an error message, we can help users identifying the issue)
      */
     @Test
-    public void testNonexistingQueueWARNmessage() throws Exception {
+    void testNonexistingQueueWARNmessage() throws Exception {
         runTest(
                 () -> {
                     LOG.info("Starting testNonexistingQueueWARNmessage()");
-                    try {
-                        runWithArgs(
-                                new String[] {
-                                    "-j",
-                                    flinkUberjar.getAbsolutePath(),
-                                    "-t",
-                                    flinkLibFolder.getAbsolutePath(),
-                                    "-jm",
-                                    "768m",
-                                    "-tm",
-                                    "1024m",
-                                    "-qu",
-                                    "doesntExist"
-                                },
-                                "to unknown queue: doesntExist",
-                                null,
-                                RunTypes.YARN_SESSION,
-                                1);
-                    } catch (Exception e) {
-                        assertTrue(
-                                ExceptionUtils.findThrowableWithMessage(
-                                                e, "to unknown queue: doesntExist")
-                                        .isPresent());
-                    }
-                    assertThat(
-                            yarTestLoggerResource.getMessages(),
-                            hasItem(
-                                    containsString(
-                                            "The specified queue 'doesntExist' does not exist. Available queues")));
+                    assertThatThrownBy(
+                                    () ->
+                                            runWithArgs(
+                                                    new String[] {
+                                                        "-j",
+                                                        flinkUberjar.getAbsolutePath(),
+                                                        "-t",
+                                                        flinkLibFolder.getAbsolutePath(),
+                                                        "-jm",
+                                                        "768m",
+                                                        "-tm",
+                                                        "1024m",
+                                                        "-qu",
+                                                        "doesntExist"
+                                                    },
+                                                    "to unknown queue: doesntExist",
+                                                    null,
+                                                    RunTypes.YARN_SESSION,
+                                                    1))
+                            .isInstanceOf(Exception.class)
+                            .getRootCause()
+                            .hasMessageContaining("to unknown queue: doesntExist");

Review Comment:
   @zentol  Do you think I could use original `ExceptionUtils.findThrowableWithMessage` to instead `FlinkAssertions` ? 



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