You are viewing a plain text version of this content. The canonical link for it is here.
Posted to common-commits@hadoop.apache.org by gi...@apache.org on 2019/04/01 18:22:10 UTC

[hadoop] branch trunk updated: YARN-9431. Fix flaky junit test fair.TestAppRunnability after YARN-8967. Contributed by Wilfred Spiegelenburg.

This is an automated email from the ASF dual-hosted git repository.

gifuma pushed a commit to branch trunk
in repository https://gitbox.apache.org/repos/asf/hadoop.git


The following commit(s) were added to refs/heads/trunk by this push:
     new da7f8c2  YARN-9431. Fix flaky junit test fair.TestAppRunnability after YARN-8967. Contributed by Wilfred Spiegelenburg.
da7f8c2 is described below

commit da7f8c244d9ff3a3616f6b1dd4ebe3f35bfd3bbe
Author: Giovanni Matteo Fumarola <gi...@apache.org>
AuthorDate: Mon Apr 1 11:21:31 2019 -0700

    YARN-9431. Fix flaky junit test fair.TestAppRunnability after YARN-8967. Contributed by Wilfred Spiegelenburg.
---
 .../scheduler/fair/FairSchedulerTestBase.java            |  7 ++++++-
 .../scheduler/fair/TestAppRunnability.java               | 16 ++++++++--------
 2 files changed, 14 insertions(+), 9 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/fair/FairSchedulerTestBase.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/FairSchedulerTestBase.java
index f149cb0..b931618 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/FairSchedulerTestBase.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/FairSchedulerTestBase.java
@@ -293,11 +293,16 @@ public class FairSchedulerTestBase {
       Resource amResource, List<ResourceRequest> amReqs) {
     RMContext rmContext = resourceManager.getRMContext();
     ApplicationId appId = attId.getApplicationId();
+    // This fakes the placement which is not part of the scheduler anymore
+    ApplicationPlacementContext placementCtx =
+        new ApplicationPlacementContext(queue);
+    // Set the placement in the app and not just in the event in the next call
+    // otherwise with out of order event processing we might remove the app.
     RMApp rmApp = new RMAppImpl(appId, rmContext, conf, null, user, null,
         ApplicationSubmissionContext.newInstance(appId, null, queue, null,
             mock(ContainerLaunchContext.class), false, false, 0, amResource,
             null),
-        scheduler, null, 0, null, null, amReqs);
+        scheduler, null, 0, null, null, amReqs, placementCtx, -1);
     rmContext.getRMApps().put(appId, rmApp);
   }
 
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/TestAppRunnability.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/TestAppRunnability.java
index 03338f4..b7ef471 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/TestAppRunnability.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/TestAppRunnability.java
@@ -89,27 +89,27 @@ public class TestAppRunnability extends FairSchedulerTestBase {
   }
 
   @Test
-  public void testNotUserAsDefaultQueue() throws Exception {
+  public void testNotUserAsDefaultQueue() {
 
-    // Restarting resource manager since the Conf object is changed changed.
-    resourceManager.stop();
+    // We need a new scheduler since we want to change the conf object. This
+    // requires a new RM to propagate it . Do a proper teardown to not leak
+    tearDown();
+    // Create a new one with the amended config.
     conf.set(FairSchedulerConfiguration.USER_AS_DEFAULT_QUEUE, "false");
     resourceManager = new MockRM(conf);
     resourceManager.start();
     scheduler = (FairScheduler) resourceManager.getResourceScheduler();
 
     ApplicationAttemptId appAttemptId = createAppAttemptId(1, 1);
-    createApplicationWithAMResource(appAttemptId, "default", "user2", null);
-    assertEquals(0, scheduler.getQueueManager().getLeafQueue("user1", true)
-        .getNumRunnableApps());
+    createApplicationWithAMResource(appAttemptId, "default", "user1", null);
     assertEquals(1, scheduler.getQueueManager().getLeafQueue("default", true)
         .getNumRunnableApps());
-    assertEquals(0, scheduler.getQueueManager().getLeafQueue("user2", true)
+    assertEquals(0, scheduler.getQueueManager().getLeafQueue("user1", true)
         .getNumRunnableApps());
   }
 
   @Test
-  public void testAppAdditionAndRemoval() throws Exception {
+  public void testAppAdditionAndRemoval() {
     ApplicationAttemptId attemptId = createAppAttemptId(1, 1);
     ApplicationPlacementContext apc =
         new ApplicationPlacementContext("user1");


---------------------------------------------------------------------
To unsubscribe, e-mail: common-commits-unsubscribe@hadoop.apache.org
For additional commands, e-mail: common-commits-help@hadoop.apache.org