From 80735a15a500a856422db0ebc8073fb4c1f61135 Mon Sep 17 00:00:00 2001 From: Jonathan Hung Date: Mon, 9 Sep 2019 20:15:42 -0700 Subject: [PATCH] YARN-8541 (branch-3.1 addendum): RM startup failure on recovery after user deletion --- .../placement/TestPlacementManager.java | 20 ++++++++----------- 1 file changed, 8 insertions(+), 12 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/placement/TestPlacementManager.java b/hadoop-yarn-project/hadoop-yarn/hadoop-yarn-server/hadoop-yarn-server-resourcemanager/src/test/java/org/apache/hadoop/yarn/server/resourcemanager/placement/TestPlacementManager.java index 13111bef390..db5cd60e580 100644 --- a/hadoop-yarn-project/hadoop-yarn/hadoop-yarn-server/hadoop-yarn-server-resourcemanager/src/test/java/org/apache/hadoop/yarn/server/resourcemanager/placement/TestPlacementManager.java +++ b/hadoop-yarn-project/hadoop-yarn/hadoop-yarn-server/hadoop-yarn-server-resourcemanager/src/test/java/org/apache/hadoop/yarn/server/resourcemanager/placement/TestPlacementManager.java @@ -83,16 +83,11 @@ public class TestPlacementManager { ApplicationSubmissionContext asc = Records.newRecord( ApplicationSubmissionContext.class); + asc.setQueue(YarnConfiguration.DEFAULT_QUEUE_NAME); asc.setApplicationName(APP_NAME); - boolean caughtException = false; - try{ - pm.placeApplication(asc, USER2); - } catch (Exception e) { - caughtException = true; - } - Assert.assertTrue(caughtException); - + Assert.assertNull("Placement should be null", + pm.placeApplication(asc, USER2)); QueueMappingEntity queueMappingEntity = new QueueMappingEntity(APP_NAME, USER1, PARENT_QUEUE); @@ -100,12 +95,13 @@ public class TestPlacementManager { Arrays.asList(queueMappingEntity)); queuePlacementRules.add(anRule); pm.updateRules(queuePlacementRules); - try{ - pm.placeApplication(asc, USER2); + try { + ApplicationPlacementContext pc = pm.placeApplication(asc, USER2); + Assert.assertNotNull(pc); } catch (Exception e) { - caughtException = false; + e.printStackTrace(); + Assert.fail("Exception not expected"); } - Assert.assertFalse(caughtException); } } \ No newline at end of file