tillrohrmann commented on a change in pull request #8053: [FLINK-12015] Fix
TaskManagerRunnerTest instability
URL: https://github.com/apache/flink/pull/8053#discussion_r269562512
##########
File path:
flink-runtime/src/test/java/org/apache/flink/runtime/taskexecutor/TaskManagerRunnerTest.java
##########
@@ -45,44 +43,46 @@
@Rule
public final Timeout timeout = Timeout.seconds(30);
+ private SystemExitTrackingSecurityManager
systemExitTrackingSecurityManager;
+ private TaskManagerRunner taskManagerRunner;
+
+ @Before
+ public void before() {
+ systemExitTrackingSecurityManager = new
SystemExitTrackingSecurityManager();
+ System.setSecurityManager(systemExitTrackingSecurityManager);
+ }
+
+ @After
+ public void after() throws Exception {
+ System.setSecurityManager(null);
+ if (taskManagerRunner != null) {
+ taskManagerRunner.close();
+ }
+ }
+
@Test
public void testShouldShutdownOnFatalError() throws Exception {
- try (TaskManagerRunner taskManagerRunner =
createTaskManagerRunner(createConfiguration())) {
- taskManagerRunner.start();
+ taskManagerRunner =
createTaskManagerRunner(createConfiguration());
- final SystemExitTrackingSecurityManager
systemExitTrackingSecurityManager =
- runWithSystemExitTracking(() -> {
- taskManagerRunner.onFatalError(new
RuntimeException());
-
taskManagerRunner.getTerminationFuture().get(30, TimeUnit.SECONDS);
- });
+ taskManagerRunner.onFatalError(new RuntimeException());
+ eventually(() -> {
Review comment:
Instead of busy looping, I would prefer to change the
`SystemExitTrackingSecurityManager` to return a `CompletableFuture<Integer>`
which is completed with the exit code with which `System.exit(exitCode)` is
called.
----------------------------------------------------------------
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]
With regards,
Apache Git Services