From e286ae90b7f9b71724777e684613cfb1dfcfc0e8 Mon Sep 17 00:00:00 2001 From: Zhijie Shen Date: Fri, 31 Oct 2014 18:02:39 -0700 Subject: [PATCH] HADOOP-11241. Fixed intermittent TestNMSimulator failure due to timing issue. Contributed by Varun Vasudev. (cherry picked from commit 260ab6d5f462d0fe1a4312cbba1c098141e3870e) --- hadoop-common-project/hadoop-common/CHANGES.txt | 3 +++ .../hadoop/yarn/sls/nodemanager/TestNMSimulator.java | 10 ++++++++++ 2 files changed, 13 insertions(+) diff --git a/hadoop-common-project/hadoop-common/CHANGES.txt b/hadoop-common-project/hadoop-common/CHANGES.txt index d3631f3c13e..eaf825be98a 100644 --- a/hadoop-common-project/hadoop-common/CHANGES.txt +++ b/hadoop-common-project/hadoop-common/CHANGES.txt @@ -698,6 +698,9 @@ Release 2.6.0 - UNRELEASED HADOOP-11221. IdentityHashStore assumes System.identityHashCode() is non-negative. (Jinghui Wang via szetszwo) + HADOOP-11241. Fixed intermittent TestNMSimulator failure due to timing issue. + (Varun Vasudev via zjshen) + Release 2.5.1 - 2014-09-05 INCOMPATIBLE CHANGES diff --git a/hadoop-tools/hadoop-sls/src/test/java/org/apache/hadoop/yarn/sls/nodemanager/TestNMSimulator.java b/hadoop-tools/hadoop-sls/src/test/java/org/apache/hadoop/yarn/sls/nodemanager/TestNMSimulator.java index 84be2313cf4..2381549b1c3 100644 --- a/hadoop-tools/hadoop-sls/src/test/java/org/apache/hadoop/yarn/sls/nodemanager/TestNMSimulator.java +++ b/hadoop-tools/hadoop-sls/src/test/java/org/apache/hadoop/yarn/sls/nodemanager/TestNMSimulator.java @@ -54,6 +54,16 @@ public class TestNMSimulator { node1.init("rack1/node1", GB * 10, 10, 0, 1000, rm); node1.middleStep(); + int numClusterNodes = rm.getResourceScheduler().getNumClusterNodes(); + int cumulativeSleepTime = 0; + int sleepInterval = 100; + + while(numClusterNodes != 1 && cumulativeSleepTime < 5000) { + Thread.sleep(sleepInterval); + cumulativeSleepTime = cumulativeSleepTime + sleepInterval; + numClusterNodes = rm.getResourceScheduler().getNumClusterNodes(); + } + Assert.assertEquals(1, rm.getResourceScheduler().getNumClusterNodes()); Assert.assertEquals(GB * 10, rm.getResourceScheduler().getRootQueueMetrics().getAvailableMB());