tillrohrmann commented on a change in pull request #13319:
URL: https://github.com/apache/flink/pull/13319#discussion_r508455913



##########
File path: 
flink-runtime/src/test/java/org/apache/flink/runtime/taskexecutor/TaskManagerRunnerTest.java
##########
@@ -144,6 +148,58 @@ public void 
testGenerateTaskManagerResourceIDWithLocalRpcService() throws Except
                assertThat(taskManagerResourceID.getResourceIdString(), 
containsString(InetAddress.getLocalHost().getHostName()));
        }
 
+       @Test
+       public void testUnexpectedTaskManagerTerminationFailsRunnerFatally() 
throws Exception {
+               final CompletableFuture<Void> terminationFuture = new 
CompletableFuture<>();
+               final TestingTaskExecutorService taskExecutorService = 
TestingTaskExecutorService.newBuilder()
+                               .setTerminationFuture(terminationFuture)
+                               .build();
+               final TaskManagerRunner taskManagerRunner = 
createTaskManagerRunner(
+                               createConfiguration(),
+                               (configuration,
+                               resourceID,
+                               rpcService,
+                               highAvailabilityServices,
+                               heartbeatServices,
+                               metricRegistry,
+                               blobCacheService,
+                               localCommunicationOnly,
+                               externalResourceInfoProvider,
+                               fatalErrorHandler) -> taskExecutorService);
+
+               terminationFuture.completeExceptionally(new 
FlinkException("Test exception."));
+
+               Integer statusCode = 
systemExitTrackingSecurityManager.getSystemExitFuture().get();
+               assertThat(statusCode, 
is(equalTo(TaskManagerRunner.RUNTIME_FAILURE_RETURN_CODE)));
+       }
+
+       @Test
+       public void 
testUnexpectedTaskManagerTerminationAfterRunnerCloseWillBeIgnored() throws 
Exception {
+               final CompletableFuture<Void> terminationFuture = new 
CompletableFuture<>();
+               final TestingTaskExecutorService taskExecutorService = 
TestingTaskExecutorService.newBuilder()
+                               .setTerminationFuture(terminationFuture)
+                               .withManualTerminationFutureCompletion()
+                               .build();
+               final TaskManagerRunner taskManagerRunner = 
createTaskManagerRunner(
+                               createConfiguration(),
+                               (configuration,
+                               resourceID,
+                               rpcService,
+                               highAvailabilityServices,
+                               heartbeatServices,
+                               metricRegistry,
+                               blobCacheService,
+                               localCommunicationOnly,
+                               externalResourceInfoProvider,
+                               fatalErrorHandler) -> taskExecutorService);

Review comment:
       Good idea. Will do.




----------------------------------------------------------------
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:
[email protected]


Reply via email to