diff --git a/hadoop-yarn-project/hadoop-yarn/hadoop-yarn-server/hadoop-yarn-server-nodemanager/src/test/java/org/apache/hadoop/yarn/server/nodemanager/TestNodeStatusUpdater.java b/hadoop-yarn-project/hadoop-yarn/hadoop-yarn-server/hadoop-yarn-server-nodemanager/src/test/java/org/apache/hadoop/yarn/server/nodemanager/TestNodeStatusUpdater.java index e7d18b7ecdf..c71b1e6f6ac 100644 --- a/hadoop-yarn-project/hadoop-yarn/hadoop-yarn-server/hadoop-yarn-server-nodemanager/src/test/java/org/apache/hadoop/yarn/server/nodemanager/TestNodeStatusUpdater.java +++ b/hadoop-yarn-project/hadoop-yarn/hadoop-yarn-server/hadoop-yarn-server-nodemanager/src/test/java/org/apache/hadoop/yarn/server/nodemanager/TestNodeStatusUpdater.java @@ -561,6 +561,8 @@ public class TestNodeStatusUpdater { @Override protected void serviceStop() throws Exception { + // Make sure that all containers are started before starting shutdown + syncBarrier.await(10000, TimeUnit.MILLISECONDS); System.out.println("Called stooppppp"); super.serviceStop(); isStopped = true; @@ -1757,6 +1759,9 @@ public class TestNodeStatusUpdater { new File("start_file.txt"), port); try { + // Wait until we start stopping + syncBarrier.await(10000, TimeUnit.MILLISECONDS); + // Wait until we finish stopping syncBarrier.await(10000, TimeUnit.MILLISECONDS); } catch (Exception e) { }