From b5df25e3a83ebb1efd9c23afc188024347724aa8 Mon Sep 17 00:00:00 2001 From: Sanford Ryza Date: Sat, 5 Oct 2013 22:12:24 +0000 Subject: [PATCH] YARN-1268. TestFairScheduler.testContinuousScheduling is flaky (Sandy Ryza) git-svn-id: https://svn.apache.org/repos/asf/hadoop/common/branches/branch-2@1529533 13f79535-47bb-0310-9956-ffa450edef68 --- hadoop-yarn-project/CHANGES.txt | 2 ++ .../scheduler/fair/TestFairScheduler.java | 12 +++++++----- 2 files changed, 9 insertions(+), 5 deletions(-) diff --git a/hadoop-yarn-project/CHANGES.txt b/hadoop-yarn-project/CHANGES.txt index 0c0a61ed3e6..9d88a21c507 100644 --- a/hadoop-yarn-project/CHANGES.txt +++ b/hadoop-yarn-project/CHANGES.txt @@ -48,6 +48,8 @@ Release 2.3.0 - UNRELEASED YARN-1188. The context of QueueMetrics becomes default when using FairScheduler (Tsuyoshi Ozawa via Sandy Ryza) + + YARN-1268. TestFairScheduler.testContinuousScheduling is flaky (Sandy Ryza) Release 2.2.0 - UNRELEASED 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/fair/TestFairScheduler.java b/hadoop-yarn-project/hadoop-yarn/hadoop-yarn-server/hadoop-yarn-server-resourcemanager/src/test/java/org/apache/hadoop/yarn/server/resourcemanager/scheduler/fair/TestFairScheduler.java index 1e5bc524a0f..22c0e232af7 100644 --- a/hadoop-yarn-project/hadoop-yarn/hadoop-yarn-server/hadoop-yarn-server-resourcemanager/src/test/java/org/apache/hadoop/yarn/server/resourcemanager/scheduler/fair/TestFairScheduler.java +++ b/hadoop-yarn-project/hadoop-yarn/hadoop-yarn-server/hadoop-yarn-server-resourcemanager/src/test/java/org/apache/hadoop/yarn/server/resourcemanager/scheduler/fair/TestFairScheduler.java @@ -2279,7 +2279,7 @@ public class TestFairScheduler { fs.applications, FSSchedulerApp.class); } - @Test + @Test (timeout = 5000) public void testContinuousScheduling() throws Exception { // set continuous scheduling enabled FairScheduler fs = new FairScheduler(); @@ -2315,11 +2315,13 @@ public class TestFairScheduler { // at least one pass Thread.sleep(fs.getConf().getContinuousSchedulingSleepMs() + 500); + FSSchedulerApp app = fs.applications.get(appAttemptId); + // Wait until app gets resources. + while (app.getCurrentConsumption().equals(Resources.none())) { } + // check consumption - Resource consumption = - fs.applications.get(appAttemptId).getCurrentConsumption(); - Assert.assertEquals(1024, consumption.getMemory()); - Assert.assertEquals(1, consumption.getVirtualCores()); + Assert.assertEquals(1024, app.getCurrentConsumption().getMemory()); + Assert.assertEquals(1, app.getCurrentConsumption().getVirtualCores()); }