From 3c7cf5cd77a961d16175320aacc5bff6f4ee2f45 Mon Sep 17 00:00:00 2001 From: Varun Saxena Date: Mon, 15 Aug 2016 03:56:31 +0530 Subject: [PATCH] YARN-5491. Fix random failure of TestCapacityScheduler#testCSQueueBlocked (Bibin A Chundatt via Varun Saxena) --- .../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 2da7adbd1a7..0b52b860fd2 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 @@ -3635,7 +3635,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); @@ -3659,10 +3659,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());