YARN-9806. TestNMSimulator#testNMSimulator fails in branch-2

This commit is contained in:
Jonathan Hung 2019-09-03 11:06:51 -07:00
parent a524608d1e
commit 493b36279b
1 changed files with 9 additions and 0 deletions

View File

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