YARN-6437. TestSignalContainer#testSignalRequestDeliveryToNM fails intermittently (Jason Lowe via Varun Saxena)

(cherry picked from commit 7d963c477a)
This commit is contained in:
Varun Saxena 2017-04-06 01:20:41 +05:30
parent ab231f5e1c
commit bf2c63ce46
1 changed files with 6 additions and 7 deletions

View File

@ -69,18 +69,17 @@ public class TestSignalContainer {
//kick the scheduler //kick the scheduler
nm1.nodeHeartbeat(true); nm1.nodeHeartbeat(true);
List<Container> conts = null; List<Container> conts = new ArrayList<>(request);
int contReceived = 0;
int waitCount = 0; int waitCount = 0;
while (contReceived < request && waitCount++ < 200) { while (conts.size() < request && waitCount++ < 200) {
LOG.info("Got " + contReceived + " containers. Waiting to get " LOG.info("Got " + conts.size() + " containers. Waiting to get "
+ request); + request);
Thread.sleep(100); Thread.sleep(100);
conts = am.allocate(new ArrayList<ResourceRequest>(), List<Container> allocation = am.allocate(new ArrayList<ResourceRequest>(),
new ArrayList<ContainerId>()).getAllocatedContainers(); new ArrayList<ContainerId>()).getAllocatedContainers();
contReceived += conts.size(); conts.addAll(allocation);
} }
Assert.assertEquals(request, contReceived); Assert.assertEquals(request, conts.size());
for(Container container : conts) { for(Container container : conts) {
rm.signalToContainer(container.getId(), rm.signalToContainer(container.getId(),