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 2f10f7dbc2e..9f2b4d17a7a 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 @@ -17,6 +17,8 @@ */ package org.apache.hadoop.yarn.sls.nodemanager; +import com.google.common.base.Supplier; +import org.apache.hadoop.test.GenericTestUtils; import org.apache.hadoop.yarn.api.records.Container; import org.apache.hadoop.yarn.api.records.ContainerId; import org.apache.hadoop.yarn.conf.YarnConfiguration; @@ -88,6 +90,13 @@ public class TestNMSimulator { numClusterNodes = rm.getResourceScheduler().getNumClusterNodes(); } + GenericTestUtils.waitFor(new Supplier() { + @Override public Boolean get() { + return rm.getResourceScheduler().getRootQueueMetrics() + .getAvailableMB() > 0; + } + }, 500, 10000); + Assert.assertEquals(1, rm.getResourceScheduler().getNumClusterNodes()); Assert.assertEquals(GB * 10, rm.getResourceScheduler().getRootQueueMetrics().getAvailableMB());