From 515727f46f4ca8dcbff650ebf9047b2f74fe3a8d Mon Sep 17 00:00:00 2001 From: Jason Lowe Date: Mon, 3 Oct 2016 16:06:17 +0000 Subject: [PATCH] YARN-4543. Fix random test failure in TestNodeStatusUpdater.testStopReentrant. (Akihiro Suda via rohithsharmaks) (cherry picked from commit ac686668031ee9837deed3f3566f09f33c437870) --- .../yarn/server/nodemanager/TestNodeStatusUpdater.java | 9 ++++++++- 1 file changed, 8 insertions(+), 1 deletion(-) 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 c348d16e3d4..eea9ce79c13 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 @@ -1276,7 +1276,14 @@ public class TestNodeStatusUpdater { } Assert.assertEquals(STATE.STOPPED, nm.getServiceState()); - Assert.assertEquals(numCleanups.get(), 1); + + // It further takes a while after NM reached the STOPPED state. + waitCount = 0; + while (numCleanups.get() == 0 && waitCount++ != 20) { + LOG.info("Waiting for NM shutdown.."); + Thread.sleep(1000); + } + Assert.assertEquals(1, numCleanups.get()); } @Test