From 3656b8408529dd42e14eb87dde63db7e7b403068 Mon Sep 17 00:00:00 2001 From: Varun Saxena Date: Mon, 15 Aug 2016 03:31:21 +0530 Subject: [PATCH] YARN-5491. Fix random failure of TestCapacityScheduler#testCSQueueBlocked (Bibin A Chundatt via Varun Saxena) (cherry picked from commit d677b68c2599445fff56db4df26448a8bad0f5dd) --- .../scheduler/capacity/TestCapacityScheduler.java | 8 ++++++-- 1 file changed, 6 insertions(+), 2 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/scheduler/capacity/TestCapacityScheduler.java b/hadoop-yarn-project/hadoop-yarn/hadoop-yarn-server/hadoop-yarn-server-resourcemanager/src/test/java/org/apache/hadoop/yarn/server/resourcemanager/scheduler/capacity/TestCapacityScheduler.java index ceffebdf30c..134ebd46152 100644 --- a/hadoop-yarn-project/hadoop-yarn/hadoop-yarn-server/hadoop-yarn-server-resourcemanager/src/test/java/org/apache/hadoop/yarn/server/resourcemanager/scheduler/capacity/TestCapacityScheduler.java +++ b/hadoop-yarn-project/hadoop-yarn/hadoop-yarn-server/hadoop-yarn-server-resourcemanager/src/test/java/org/apache/hadoop/yarn/server/resourcemanager/scheduler/capacity/TestCapacityScheduler.java @@ -3606,7 +3606,7 @@ public class TestCapacityScheduler { } assertEquals("A Used Resource should be 2 GB", 2 * GB, cs.getQueue("a").getUsedResources().getMemorySize()); - assertEquals("B Used Resource should be 2 GB", 13 * GB, + assertEquals("B Used Resource should be 13 GB", 13 * GB, cs.getQueue("b").getUsedResources().getMemorySize()); r1 = TestUtils.createResourceRequest( ResourceRequest.ANY, 2 * GB, 1, true, priority, recordFactory); @@ -3630,10 +3630,14 @@ public class TestCapacityScheduler { ContainerId containerId2 =ContainerId.newContainerId(appAttemptId2, 11); cs.handle(new ContainerExpiredSchedulerEvent(containerId1)); + rm.drainEvents(); + CapacityScheduler.schedule(cs); + cs.handle(new ContainerExpiredSchedulerEvent(containerId2)); CapacityScheduler.schedule(cs); rm.drainEvents(); - assertEquals("A Used Resource should be 2 GB", 4 * GB, + + assertEquals("A Used Resource should be 4 GB", 4 * GB, cs.getQueue("a").getUsedResources().getMemorySize()); assertEquals("B Used Resource should be 12 GB", 12 * GB, cs.getQueue("b").getUsedResources().getMemorySize());