From cb5f7ef828a773a2fc61943f7862cf2fbd3b2097 Mon Sep 17 00:00:00 2001 From: Prabhu Joseph Date: Tue, 23 Apr 2019 13:12:14 +0530 Subject: [PATCH] YARN-9501 --- .../resourcemanager/scheduler/TestSchedulerOvercommit.java | 14 +++++++++++++- 1 file changed, 13 insertions(+), 1 deletion(-) 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/TestSchedulerOvercommit.java b/hadoop-yarn-project/hadoop-yarn/hadoop-yarn-server/hadoop-yarn-server-resourcemanager/src/test/java/org/apache/hadoop/yarn/server/resourcemanager/scheduler/TestSchedulerOvercommit.java index cc665fb..9580ae6 100644 --- a/hadoop-yarn-project/hadoop-yarn/hadoop-yarn-server/hadoop-yarn-server-resourcemanager/src/test/java/org/apache/hadoop/yarn/server/resourcemanager/scheduler/TestSchedulerOvercommit.java +++ b/hadoop-yarn-project/hadoop-yarn/hadoop-yarn-server/hadoop-yarn-server-resourcemanager/src/test/java/org/apache/hadoop/yarn/server/resourcemanager/scheduler/TestSchedulerOvercommit.java @@ -286,6 +286,9 @@ public void testReducePreemptAndKill() throws Exception { updateNodeResource(rm, nmId, 2 * GB, 2, timeout); waitMemory(scheduler, nm, 4 * GB, -2 * GB, INTERVAL, timeout); + // wait until MARK_CONTAINER_FOR_PREEMPTION is handled + rm.drainEvents(); + // We should receive a notification to preempt the container PreemptionMessage preemptMsg = am.schedule().getPreemptionMessage(); assertPreemption(container.getId(), preemptMsg); @@ -316,12 +319,15 @@ public void testReducePreemptAndCancel() throws Exception { assertMemory(scheduler, nmId, 4 * GB, 0); // We give an overcommit time out of 2 seconds - final int timeout = (int)TimeUnit.SECONDS.toMillis(1); + final int timeout = (int)TimeUnit.SECONDS.toMillis(2); // Reducing to 2GB should first preempt the container updateNodeResource(rm, nmId, 2 * GB, 2, timeout); waitMemory(scheduler, nm, 4 * GB, -2 * GB, INTERVAL, timeout); + // wait until MARK_CONTAINER_FOR_PREEMPTION is handled + rm.drainEvents(); + // We should receive a notification to preempt the container PreemptionMessage preemptMsg = am.schedule().getPreemptionMessage(); assertPreemption(container.getId(), preemptMsg); @@ -479,6 +485,9 @@ public void testEndToEnd() throws Exception { updateNodeResource(rm, nmId, 3 * GB, 2, 2 * 1000); waitMemory(scheduler, nmId, 5 * GB, -2 * GB, 200, 5 * 1000); + // wait until MARK_CONTAINER_FOR_PREEMPTION is handled + rm.drainEvents(); + PreemptionMessage preemptMsg = am.schedule().getPreemptionMessage(); assertPreemption(c2.getId(), preemptMsg); @@ -493,6 +502,9 @@ public void testEndToEnd() throws Exception { updateNodeResource(rm, nmId, 3 * GB, 2, 2 * 1000); waitMemory(scheduler, nmId, 5 * GB, -2 * GB, 200, 5 * 1000); + // wait until MARK_CONTAINER_FOR_PREEMPTION is handled + rm.drainEvents(); + preemptMsg = am.schedule().getPreemptionMessage(); assertPreemption(c2.getId(), preemptMsg); -- 2.7.4 (Apple Git-66)