tillrohrmann commented on a change in pull request #13571: URL: https://github.com/apache/flink/pull/13571#discussion_r503159538
########## File path: flink-yarn/src/test/java/org/apache/flink/yarn/YarnResourceManagerDriverTest.java ########## @@ -111,6 +111,32 @@ protected Context createContext() { return new Context(); } + @Test + public void testRunAsyncCausesFatalError() throws Exception { + new Context() {{ + final String exceptionMessage = "runAsyncCausesFatalError"; + addContainerRequestFutures.add(new CompletableFuture<>()); + + testingYarnAMRMClientAsyncBuilder.setAddContainerRequestConsumer((ignored1, ignored2) -> + addContainerRequestFutures.get(addContainerRequestFuturesNumCompleted.getAndIncrement()).complete(null)); + testingYarnAMRMClientAsyncBuilder.setGetMatchingRequestsFunction(ignored -> { + throw new RuntimeException(exceptionMessage); + }); + + final CompletableFuture<Throwable> throwableCompletableFuture = new CompletableFuture<>(); + resourceEventHandlerBuilder.setOnErrorConsumer(throwableCompletableFuture::complete); + + runTest(() -> { + runInMainThread(() -> getDriver().requestResource(testingTaskExecutorProcessSpec)); + resourceManagerClientCallbackHandler.onContainersAllocated(ImmutableList.of(testingContainer)); + + Throwable t = throwableCompletableFuture.get(TIMEOUT_SEC, TimeUnit.SECONDS); + assertThat(ExceptionUtils.findThrowable(t, RuntimeException.class).isPresent(), is(true)); Review comment: `ExceptionUtils.findThrowable(t, RuntimeException.class)` could be pulled out to avoid the computation in the next line. ---------------------------------------------------------------- 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: us...@infra.apache.org