diff --git a/hadoop-yarn-project/hadoop-yarn/hadoop-yarn-server/hadoop-yarn-server-resourcemanager/src/test/java/org/apache/hadoop/yarn/server/resourcemanager/scheduler/fair/TestContinuousScheduling.java b/hadoop-yarn-project/hadoop-yarn/hadoop-yarn-server/hadoop-yarn-server-resourcemanager/src/test/java/org/apache/hadoop/yarn/server/resourcemanager/scheduler/fair/TestContinuousScheduling.java index 895962d609..443c7963cc 100644 --- a/hadoop-yarn-project/hadoop-yarn/hadoop-yarn-server/hadoop-yarn-server-resourcemanager/src/test/java/org/apache/hadoop/yarn/server/resourcemanager/scheduler/fair/TestContinuousScheduling.java +++ b/hadoop-yarn-project/hadoop-yarn/hadoop-yarn-server/hadoop-yarn-server-resourcemanager/src/test/java/org/apache/hadoop/yarn/server/resourcemanager/scheduler/fair/TestContinuousScheduling.java @@ -18,7 +18,9 @@ package org.apache.hadoop.yarn.server.resourcemanager.scheduler.fair; +import com.google.common.base.Supplier; import org.apache.hadoop.conf.Configuration; +import org.apache.hadoop.test.GenericTestUtils; import org.apache.hadoop.yarn.api.records.ApplicationAttemptId; import org.apache.hadoop.yarn.api.records.ContainerId; import org.apache.hadoop.yarn.api.records.NodeId; @@ -383,8 +385,8 @@ public void testFairSchedulerContinuousSchedulingInitTime() throws Exception { true); ask1.add(request1); ask1.add(request2); - scheduler.allocate(id11, ask1, null, new ArrayList(), null, null, - NULL_UPDATE_REQUESTS); + scheduler.allocate(id11, ask1, null, new ArrayList(), null, + null, NULL_UPDATE_REQUESTS); NodeAddedSchedulerEvent nodeEvent1 = new NodeAddedSchedulerEvent(node1); scheduler.handle(nodeEvent1); @@ -393,6 +395,11 @@ public void testFairSchedulerContinuousSchedulingInitTime() throws Exception { // time mockClock.tickSec(delayThresholdTimeMs / 1000); scheduler.attemptScheduling(node); + GenericTestUtils.waitFor(new Supplier() { + public Boolean get() { + return fsAppAttempt.getLastScheduledContainer().size() != 0; + } + }, 10, 4000); Map lastScheduledContainer = fsAppAttempt.getLastScheduledContainer(); long initSchedulerTime =