YARN-7294. TestSignalContainer#testSignalRequestDeliveryToNM fails intermittently with Fair Scheduler. (Contributed by Miklos Szegedi)

(cherry picked from commit cbd2b73ef8)
This commit is contained in:
Yufei Gu 2017-10-19 16:39:25 -07:00
parent 73cbc373e0
commit 288d2fc309
1 changed files with 8 additions and 0 deletions

View File

@ -21,6 +21,7 @@ package org.apache.hadoop.yarn.server.resourcemanager;
import java.util.ArrayList;
import java.util.List;
import org.apache.hadoop.yarn.server.resourcemanager.scheduler.fair.FairScheduler;
import org.junit.Assert;
import org.apache.commons.logging.Log;
@ -50,6 +51,10 @@ public class TestSignalContainer {
Logger rootLogger = LogManager.getRootLogger();
rootLogger.setLevel(Level.DEBUG);
MockRM rm = new MockRM();
FairScheduler fs = null;
if (rm.getResourceScheduler().getClass() == FairScheduler.class) {
fs = (FairScheduler)rm.getResourceScheduler();
}
rm.start();
MockNM nm1 = rm.registerNode("h1:1234", 5000);
@ -78,6 +83,9 @@ public class TestSignalContainer {
List<Container> allocation = am.allocate(new ArrayList<ResourceRequest>(),
new ArrayList<ContainerId>()).getAllocatedContainers();
conts.addAll(allocation);
if (fs != null) {
nm1.nodeHeartbeat(true);
}
}
Assert.assertEquals(request, conts.size());