From 7d963c477ab997e0daad760dd3c568d7010fe511 Mon Sep 17 00:00:00 2001 From: Varun Saxena Date: Thu, 6 Apr 2017 01:20:41 +0530 Subject: [PATCH] YARN-6437. TestSignalContainer#testSignalRequestDeliveryToNM fails intermittently (Jason Lowe via Varun Saxena) --- .../server/resourcemanager/TestSignalContainer.java | 13 ++++++------- 1 file changed, 6 insertions(+), 7 deletions(-) diff --git a/hadoop-yarn-project/hadoop-yarn/hadoop-yarn-server/hadoop-yarn-server-resourcemanager/src/test/java/org/apache/hadoop/yarn/server/resourcemanager/TestSignalContainer.java b/hadoop-yarn-project/hadoop-yarn/hadoop-yarn-server/hadoop-yarn-server-resourcemanager/src/test/java/org/apache/hadoop/yarn/server/resourcemanager/TestSignalContainer.java index 692924c01d..2688987ed5 100644 --- a/hadoop-yarn-project/hadoop-yarn/hadoop-yarn-server/hadoop-yarn-server-resourcemanager/src/test/java/org/apache/hadoop/yarn/server/resourcemanager/TestSignalContainer.java +++ b/hadoop-yarn-project/hadoop-yarn/hadoop-yarn-server/hadoop-yarn-server-resourcemanager/src/test/java/org/apache/hadoop/yarn/server/resourcemanager/TestSignalContainer.java @@ -69,18 +69,17 @@ public void testSignalRequestDeliveryToNM() throws Exception { //kick the scheduler nm1.nodeHeartbeat(true); - List conts = null; - int contReceived = 0; + List conts = new ArrayList<>(request); int waitCount = 0; - while (contReceived < request && waitCount++ < 200) { - LOG.info("Got " + contReceived + " containers. Waiting to get " + while (conts.size() < request && waitCount++ < 200) { + LOG.info("Got " + conts.size() + " containers. Waiting to get " + request); Thread.sleep(100); - conts = am.allocate(new ArrayList(), + List allocation = am.allocate(new ArrayList(), new ArrayList()).getAllocatedContainers(); - contReceived += conts.size(); + conts.addAll(allocation); } - Assert.assertEquals(request, contReceived); + Assert.assertEquals(request, conts.size()); for(Container container : conts) { rm.signalToContainer(container.getId(),