You are viewing a plain text version of this content. The canonical link for it is here.
Posted to commits@flink.apache.org by ch...@apache.org on 2019/03/13 09:02:43 UTC

[flink] branch release-1.8 updated: [FLINK-10756][runtime][tests] Wait for TM processes to shutdown

This is an automated email from the ASF dual-hosted git repository.

chesnay pushed a commit to branch release-1.8
in repository https://gitbox.apache.org/repos/asf/flink.git


The following commit(s) were added to refs/heads/release-1.8 by this push:
     new 8779040  [FLINK-10756][runtime][tests] Wait for TM processes to shutdown
8779040 is described below

commit 8779040bd2ace935b877a50ede9ec269ac6fff9a
Author: zentol <ch...@apache.org>
AuthorDate: Thu Mar 7 10:00:13 2019 +0100

    [FLINK-10756][runtime][tests] Wait for TM processes to shutdown
---
 ...AbstractTaskManagerProcessFailureRecoveryTest.java | 19 +++++++++++++++++++
 1 file changed, 19 insertions(+)

diff --git a/flink-tests/src/test/java/org/apache/flink/test/recovery/AbstractTaskManagerProcessFailureRecoveryTest.java b/flink-tests/src/test/java/org/apache/flink/test/recovery/AbstractTaskManagerProcessFailureRecoveryTest.java
index 24f9327..ea55939 100644
--- a/flink-tests/src/test/java/org/apache/flink/test/recovery/AbstractTaskManagerProcessFailureRecoveryTest.java
+++ b/flink-tests/src/test/java/org/apache/flink/test/recovery/AbstractTaskManagerProcessFailureRecoveryTest.java
@@ -41,9 +41,12 @@ import org.junit.rules.TemporaryFolder;
 import org.slf4j.Logger;
 import org.slf4j.LoggerFactory;
 
+import javax.annotation.Nullable;
+
 import java.io.File;
 import java.io.FileOutputStream;
 import java.io.IOException;
+import java.util.concurrent.TimeUnit;
 import java.util.concurrent.atomic.AtomicReference;
 
 import static org.apache.flink.runtime.testutils.CommonTestUtils.getJavaCommandPath;
@@ -213,6 +216,22 @@ public abstract class AbstractTaskManagerProcessFailureRecoveryTest extends Test
 			if (taskManagerProcess3 != null) {
 				taskManagerProcess3.destroy();
 			}
+
+			waitForShutdown("TaskManager 1", taskManagerProcess1);
+			waitForShutdown("TaskManager 2", taskManagerProcess2);
+			waitForShutdown("TaskManager 3", taskManagerProcess3);
+		}
+	}
+
+	private void waitForShutdown(final String processName, @Nullable final TestProcess process) throws InterruptedException {
+		if (process == null) {
+			return;
+		}
+
+		if (!process.getProcess().waitFor(30, TimeUnit.SECONDS)) {
+			log.error("{} did not shutdown in time.", processName);
+			printProcessLog(processName, process.getOutput().toString());
+			process.getProcess().destroyForcibly();
 		}
 	}