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/TestAppNameMappingPlacementRule.java b/hadoop-yarn-project/hadoop-yarn/hadoop-yarn-server/hadoop-yarn-server-resourcemanager/src/test/java/org/apache/hadoop/yarn/server/resourcemanager/placement/TestAppNameMappingPlacementRule.java index 29141aedf6..9bcac9ace4 100644 --- a/hadoop-yarn-project/hadoop-yarn/hadoop-yarn-server/hadoop-yarn-server-resourcemanager/src/test/java/org/apache/hadoop/yarn/server/resourcemanager/placement/TestAppNameMappingPlacementRule.java +++ b/hadoop-yarn-project/hadoop-yarn/hadoop-yarn-server/hadoop-yarn-server-resourcemanager/src/test/java/org/apache/hadoop/yarn/server/resourcemanager/placement/TestAppNameMappingPlacementRule.java @@ -20,19 +20,24 @@ import org.apache.hadoop.fs.CommonConfigurationKeys; import org.apache.hadoop.security.GroupMappingServiceProvider; +import org.apache.hadoop.security.Groups; import org.apache.hadoop.yarn.api.records.ApplicationSubmissionContext; import org.apache.hadoop.yarn.conf.YarnConfiguration; import org.apache.hadoop.yarn.exceptions.YarnException; +import org.apache.hadoop.yarn.server.resourcemanager.scheduler.capacity.CapacityScheduler; +import org.apache.hadoop.yarn.server.resourcemanager.scheduler.capacity.CapacitySchedulerConfiguration; import org.apache.hadoop.yarn.server.resourcemanager.scheduler.capacity.CapacitySchedulerQueueManager; import org.apache.hadoop.yarn.server.resourcemanager.scheduler.fair.SimpleGroupsMapping; import org.apache.hadoop.yarn.util.Records; import org.junit.Assert; import org.junit.Before; import org.junit.Test; -import org.mockito.Mockito; -import java.util.Arrays; +import java.io.IOException; +import java.util.Collections; +import static org.apache.hadoop.yarn.server.resourcemanager.placement.FairQueuePlacementUtils.DOT; +import static org.mockito.ArgumentMatchers.isNull; import static org.mockito.Mockito.mock; import static org.mockito.Mockito.when; @@ -55,24 +60,37 @@ public void setup() { SimpleGroupsMapping.class, GroupMappingServiceProvider.class); } + private void createQueueHierarchy( + CapacitySchedulerQueueManager queueManager) { + MockQueueHierarchyBuilder.create() + .withQueueManager(queueManager) + .withQueue(ROOT_QUEUE + DOT + Q1_QUEUE) + .withQueue(ROOT_QUEUE + DOT + Q2_QUEUE) + .withQueue(ROOT_QUEUE + DOT + DEFAULT_QUEUE) + .withQueue(ROOT_QUEUE + DOT + AMBIGUOUS_QUEUE) + .withQueue(ROOT_QUEUE + DOT + USER_NAME + DOT + AMBIGUOUS_QUEUE) + .build(); + + when(queueManager.getQueue(isNull())).thenReturn(null); + } + private void verifyQueueMapping(QueueMapping queueMapping, - String user, String expectedQueue) throws YarnException { + String user, String expectedQueue) + throws IOException, YarnException { verifyQueueMapping(queueMapping, user, queueMapping.getQueue(), expectedQueue, false); } private void verifyQueueMapping(QueueMapping queueMapping, - String user, String inputQueue, String expectedQueue, - boolean overwrite) throws YarnException { - AppNameMappingPlacementRule rule = new AppNameMappingPlacementRule( - overwrite, Arrays.asList(queueMapping)); + String user, String inputQueue, + String expectedQueue, boolean overwrite) + throws IOException, YarnException { + MappingRule rule = MappingRule.createLegacyRule( + queueMapping.getType().toString(), + queueMapping.getSource(), + queueMapping.getFullPath()); - CapacitySchedulerQueueManager qm = - mock(CapacitySchedulerQueueManager.class); - when(qm.isAmbiguous(Mockito.isA(String.class))).thenReturn(false); - when(qm.isAmbiguous(AMBIGUOUS_QUEUE)).thenReturn(true); - - rule.queueManager = qm; + CSMappingPlacementRule engine = setupEngine(rule, overwrite); ApplicationSubmissionContext asc = Records.newRecord( ApplicationSubmissionContext.class); @@ -87,18 +105,45 @@ private void verifyQueueMapping(QueueMapping queueMapping, appName = APP_NAME; } asc.setApplicationName(appName); - ApplicationPlacementContext ctx = rule.getPlacementForApp(asc, + ApplicationPlacementContext ctx = engine.getPlacementForApp(asc, user); Assert.assertEquals(expectedQueue, ctx != null ? ctx.getQueue() : inputQueue); } + CSMappingPlacementRule setupEngine(MappingRule rule, boolean override) + throws IOException { + + CapacitySchedulerConfiguration csConf = + mock(CapacitySchedulerConfiguration.class); + when(csConf.getMappingRules()).thenReturn(Collections.singletonList(rule)); + when(csConf.getOverrideWithQueueMappings()) + .thenReturn(override); + CapacitySchedulerQueueManager queueManager = + mock(CapacitySchedulerQueueManager.class); + + createQueueHierarchy(queueManager); + + CSMappingPlacementRule engine = new CSMappingPlacementRule(); + Groups groups = new Groups(conf); + + CapacityScheduler cs = mock(CapacityScheduler.class); + when(cs.getConfiguration()).thenReturn(csConf); + when(cs.getCapacitySchedulerQueueManager()).thenReturn(queueManager); + + engine.setGroups(groups); + engine.setFailOnConfigError(false); + engine.initialize(cs); + + return engine; + } + public QueueMapping getQueueMapping(String source, String queue) { return getQueueMapping(source, null, queue); } public QueueMapping getQueueMapping(String source, String parent, - String queue) { + String queue) { return QueueMapping.QueueMappingBuilder.create() .type(QueueMapping.MappingType.APPLICATION) .source(source) @@ -108,70 +153,73 @@ public QueueMapping getQueueMapping(String source, String parent, } @Test - public void testSpecificAppNameMappedToDefinedQueue() throws YarnException { + public void testSpecificAppNameMappedToDefinedQueue() + throws IOException, YarnException { verifyQueueMapping(getQueueMapping(APP_NAME, Q1_QUEUE), USER_NAME, Q1_QUEUE); } @Test - public void testPlaceholderAppSourceMappedToQueue() throws YarnException { + public void testPlaceholderAppSourceMappedToQueue() + throws IOException, YarnException { verifyQueueMapping(getQueueMapping(APPLICATION_PLACEHOLDER, Q2_QUEUE), USER_NAME, Q2_QUEUE); } @Test public void testPlaceHolderAppSourceAndQueueMappedToAppNameQueue() - throws YarnException { + throws IOException, YarnException { verifyQueueMapping(getQueueMapping(APPLICATION_PLACEHOLDER, APPLICATION_PLACEHOLDER), USER_NAME, APP_NAME); } @Test public void testQueueInMappingOverridesSpecifiedQueue() - throws YarnException { + throws IOException, YarnException { verifyQueueMapping(getQueueMapping(APP_NAME, Q1_QUEUE), USER_NAME, Q2_QUEUE, Q1_QUEUE, true); } @Test public void testQueueInMappingDoesNotOverrideSpecifiedQueue() - throws YarnException { + throws IOException, YarnException { verifyQueueMapping(getQueueMapping(APP_NAME, Q1_QUEUE), USER_NAME, Q2_QUEUE, Q2_QUEUE, false); } @Test public void testDefaultQueueInMappingIsNotUsedWithoutOverride() - throws YarnException { + throws IOException, YarnException { verifyQueueMapping(getQueueMapping(APP_NAME, DEFAULT_QUEUE), USER_NAME, Q2_QUEUE, Q2_QUEUE, false); } @Test public void testDefaultQueueInMappingEqualsToInputQueue() - throws YarnException { + throws IOException, YarnException { verifyQueueMapping(getQueueMapping(APP_NAME, DEFAULT_QUEUE), USER_NAME, DEFAULT_QUEUE, DEFAULT_QUEUE, false); } @Test - public void testMappingSourceDiffersFromInputQueue() throws YarnException { + public void testMappingSourceDiffersFromInputQueue() + throws IOException, YarnException { verifyQueueMapping(getQueueMapping(MAPREDUCE_APP_NAME, Q1_QUEUE), USER_NAME, DEFAULT_QUEUE, DEFAULT_QUEUE, false); } - @Test(expected = YarnException.class) + @Test public void testMappingContainsAmbiguousLeafQueueWithoutParent() - throws YarnException { + throws IOException, YarnException { verifyQueueMapping(getQueueMapping(APP_NAME, AMBIGUOUS_QUEUE), USER_NAME, DEFAULT_QUEUE, DEFAULT_QUEUE, false); } @Test public void testMappingContainsAmbiguousLeafQueueWithParent() - throws YarnException { + throws IOException, YarnException { verifyQueueMapping(getQueueMapping(APP_NAME, ROOT_QUEUE, AMBIGUOUS_QUEUE), USER_NAME, DEFAULT_QUEUE, AMBIGUOUS_QUEUE, false); } -} \ No newline at end of file +} 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/TestUserGroupMappingPlacementRule.java b/hadoop-yarn-project/hadoop-yarn/hadoop-yarn-server/hadoop-yarn-server-resourcemanager/src/test/java/org/apache/hadoop/yarn/server/resourcemanager/placement/TestUserGroupMappingPlacementRule.java index 6cd1d523be..79f1d406e6 100644 --- a/hadoop-yarn-project/hadoop-yarn/hadoop-yarn-server/hadoop-yarn-server-resourcemanager/src/test/java/org/apache/hadoop/yarn/server/resourcemanager/placement/TestUserGroupMappingPlacementRule.java +++ b/hadoop-yarn-project/hadoop-yarn/hadoop-yarn-server/hadoop-yarn-server-resourcemanager/src/test/java/org/apache/hadoop/yarn/server/resourcemanager/placement/TestUserGroupMappingPlacementRule.java @@ -23,7 +23,8 @@ import static org.mockito.Mockito.when; import static org.mockito.Mockito.isNull; -import java.util.Arrays; +import java.io.IOException; +import java.util.Collections; import org.apache.hadoop.fs.CommonConfigurationKeys; import org.apache.hadoop.security.GroupMappingServiceProvider; @@ -35,6 +36,8 @@ import org.apache.hadoop.yarn.server.resourcemanager.placement.QueueMapping.MappingType; import org.apache.hadoop.yarn.server.resourcemanager.placement.QueueMapping.QueueMappingBuilder; import org.apache.hadoop.yarn.server.resourcemanager.placement.TestUserGroupMappingPlacementRule.QueueMappingTestData.QueueMappingTestDataBuilder; +import org.apache.hadoop.yarn.server.resourcemanager.scheduler.capacity.CapacityScheduler; +import org.apache.hadoop.yarn.server.resourcemanager.scheduler.capacity.CapacitySchedulerConfiguration; import org.apache.hadoop.yarn.server.resourcemanager.scheduler.capacity.CapacitySchedulerQueueManager; import org.apache.hadoop.yarn.server.resourcemanager.scheduler.fair.PrimaryGroupMapping; import org.apache.hadoop.yarn.server.resourcemanager.scheduler.fair.SimpleGroupsMapping; @@ -42,14 +45,9 @@ import org.junit.Assert; import org.junit.Before; import org.junit.Test; -import org.slf4j.Logger; -import org.slf4j.LoggerFactory; public class TestUserGroupMappingPlacementRule { - private static final Logger LOG = - LoggerFactory.getLogger(TestUserGroupMappingPlacementRule.class); - - YarnConfiguration conf = new YarnConfiguration(); + private final YarnConfiguration conf = new YarnConfiguration(); @Before public void setup() { @@ -57,9 +55,27 @@ public void setup() { SimpleGroupsMapping.class, GroupMappingServiceProvider.class); } - private void verifyQueueMapping(QueueMappingTestData queueMappingTestData) - throws YarnException { + private void createQueueHierarchy( + CapacitySchedulerQueueManager queueManager) { + MockQueueHierarchyBuilder.create() + .withQueueManager(queueManager) + .withQueue("root.default") + .withQueue("root.agroup.a") + .withQueue("root.bgroup") + .withQueue("root.usergroup.c") + .withQueue("root.asubgroup2") + .withQueue("root.bsubgroup2.b") + .withQueue("root.users.primarygrouponly") + .withQueue("root.devs.primarygrouponly") + .withQueue("root.admins.primarygrouponly") + .withManagedParentQueue("root.managedParent") + .build(); + when(queueManager.getQueue(isNull())).thenReturn(null); + } + + private void verifyQueueMapping(QueueMappingTestData queueMappingTestData) + throws IOException, YarnException { QueueMapping queueMapping = queueMappingTestData.queueMapping; String inputUser = queueMappingTestData.inputUser; String inputQueue = queueMappingTestData.inputQueue; @@ -67,87 +83,100 @@ private void verifyQueueMapping(QueueMappingTestData queueMappingTestData) boolean overwrite = queueMappingTestData.overwrite; String expectedParentQueue = queueMappingTestData.expectedParentQueue; - Groups groups = new Groups(conf); - UserGroupMappingPlacementRule rule = new UserGroupMappingPlacementRule( - overwrite, Arrays.asList(queueMapping), groups); - CapacitySchedulerQueueManager queueManager = - mock(CapacitySchedulerQueueManager.class); + MappingRule rule = MappingRule.createLegacyRule( + queueMapping.getType().toString(), + queueMapping.getSource(), + queueMapping.getFullPath()); - MockQueueHierarchyBuilder.create() - .withQueueManager(queueManager) - .withQueue("root.agroup.a") - .withQueue("root.asubgroup2") - .withQueue("root.bsubgroup2.b") - .withQueue("root.users.primarygrouponly") - .withQueue("root.admins.primarygrouponly") - .withManagedParentQueue("root.managedParent") - .build(); + CSMappingPlacementRule engine = setupEngine(rule, overwrite); - when(queueManager.getQueue(isNull())).thenReturn(null); - rule.setQueueManager(queueManager); ApplicationSubmissionContext asc = Records.newRecord( ApplicationSubmissionContext.class); asc.setQueue(inputQueue); - ApplicationPlacementContext ctx = rule.getPlacementForApp(asc, inputUser); + ApplicationPlacementContext ctx = engine.getPlacementForApp(asc, inputUser); Assert.assertEquals("Queue", expectedQueue, ctx != null ? ctx.getQueue() : inputQueue); - if (expectedParentQueue != null) { + if (ctx != null && expectedParentQueue != null) { Assert.assertEquals("Parent Queue", expectedParentQueue, ctx.getParentQueue()); } } + CSMappingPlacementRule setupEngine(MappingRule rule, + boolean override) + throws IOException { + + CapacitySchedulerConfiguration csConf = + mock(CapacitySchedulerConfiguration.class); + when(csConf.getMappingRules()).thenReturn(Collections.singletonList(rule)); + when(csConf.getOverrideWithQueueMappings()) + .thenReturn(override); + CapacitySchedulerQueueManager queueManager = + mock(CapacitySchedulerQueueManager.class); + createQueueHierarchy(queueManager); + + CSMappingPlacementRule engine = new CSMappingPlacementRule(); + Groups groups = new Groups(conf); + + CapacityScheduler cs = mock(CapacityScheduler.class); + when(cs.getConfiguration()).thenReturn(csConf); + when(cs.getCapacitySchedulerQueueManager()).thenReturn(queueManager); + + engine.setGroups(groups); + engine.setFailOnConfigError(false); + engine.initialize(cs); + + return engine; + } + @Test - public void testSecondaryGroupMapping() throws YarnException { + public void testSecondaryGroupMapping() throws IOException, YarnException { verifyQueueMapping( QueueMappingTestDataBuilder.create() - .queueMapping(QueueMappingBuilder.create() - .type(MappingType.USER) - .source("%user") - .queue("%secondary_group").build()) - .inputUser("a") - .expectedQueue("asubgroup2") - .expectedParentQueue("root") - .build()); + .queueMapping(QueueMappingBuilder.create() + .type(MappingType.USER) + .source("%user") + .queue("%secondary_group").build()) + .inputUser("a") + .expectedQueue("asubgroup2") + .expectedParentQueue("root") + .build()); // PrimaryGroupMapping.class returns only primary group, no secondary groups conf.setClass(CommonConfigurationKeys.HADOOP_SECURITY_GROUP_MAPPING, PrimaryGroupMapping.class, GroupMappingServiceProvider.class); verifyQueueMapping( QueueMappingTestDataBuilder.create() - .queueMapping(QueueMappingBuilder.create() - .type(MappingType.USER) - .source("%user") - .queue("%secondary_group") - .build()) - .inputUser("a") - .expectedQueue("default") - .build()); + .queueMapping(QueueMappingBuilder.create() + .type(MappingType.USER) + .source("%user") + .queue("%secondary_group") + .build()) + .inputUser("a") + .expectedQueue("default") + .build()); } - @Test - public void testNullGroupMapping() { + @Test(expected = YarnException.class) + public void testNullGroupMapping() throws IOException, YarnException { conf.setClass(CommonConfigurationKeys.HADOOP_SECURITY_GROUP_MAPPING, NullGroupsMapping.class, GroupMappingServiceProvider.class); - try { - verifyQueueMapping( - QueueMappingTestDataBuilder.create() - .queueMapping(QueueMappingBuilder.create() - .type(MappingType.USER) - .source("%user") - .queue("%secondary_group") - .build()) - .inputUser("a") - .expectedQueue("default") - .build()); - fail("No Groups for user 'a'"); - } catch (YarnException e) { - // Exception is expected as there are no groups for given user - } + verifyQueueMapping( + QueueMappingTestDataBuilder.create() + .queueMapping(QueueMappingBuilder.create() + .type(MappingType.USER) + .source("%user") + .queue("%secondary_group") + .build()) + .inputUser("a") + .expectedQueue("default") + .build()); + fail("No Groups for user 'a'"); } @Test - public void testSimpleUserMappingToSpecificQueue() throws YarnException { + public void testSimpleUserMappingToSpecificQueue() + throws IOException, YarnException { verifyQueueMapping( QueueMappingTestDataBuilder.create() .queueMapping(QueueMappingBuilder.create() @@ -161,7 +190,8 @@ public void testSimpleUserMappingToSpecificQueue() throws YarnException { } @Test - public void testSimpleGroupMappingToSpecificQueue() throws YarnException { + public void testSimpleGroupMappingToSpecificQueue() + throws IOException, YarnException { verifyQueueMapping( QueueMappingTestDataBuilder.create() .queueMapping(QueueMappingBuilder.create() @@ -175,7 +205,8 @@ public void testSimpleGroupMappingToSpecificQueue() throws YarnException { } @Test - public void testUserMappingToSpecificQueueForEachUser() throws YarnException { + public void testUserMappingToSpecificQueueForEachUser() + throws IOException, YarnException { verifyQueueMapping( QueueMappingTestDataBuilder.create() .queueMapping(QueueMappingBuilder.create() @@ -189,7 +220,8 @@ public void testUserMappingToSpecificQueueForEachUser() throws YarnException { } @Test - public void testUserMappingToQueueNamedAsUsername() throws YarnException { + public void testUserMappingToQueueNamedAsUsername() + throws IOException, YarnException { verifyQueueMapping( QueueMappingTestDataBuilder.create() .queueMapping(QueueMappingBuilder.create() @@ -203,7 +235,8 @@ public void testUserMappingToQueueNamedAsUsername() throws YarnException { } @Test - public void testUserMappingToQueueNamedGroupOfTheUser() throws YarnException { + public void testUserMappingToQueueNamedGroupOfTheUser() + throws IOException, YarnException { verifyQueueMapping( QueueMappingTestDataBuilder.create() .queueMapping(QueueMappingBuilder.create() @@ -211,15 +244,15 @@ public void testUserMappingToQueueNamedGroupOfTheUser() throws YarnException { .source("%user") .queue("%primary_group") .build()) - .inputUser("a") - .expectedQueue("agroup") + .inputUser("b") + .expectedQueue("bgroup") .expectedParentQueue("root") .build()); } @Test public void testUserMappingToQueueNamedAsUsernameWithPrimaryGroupAsParentQueue() - throws YarnException { + throws IOException, YarnException { verifyQueueMapping( QueueMappingTestDataBuilder.create() .queueMapping(QueueMappingBuilder.create() @@ -236,7 +269,7 @@ public void testUserMappingToQueueNamedAsUsernameWithPrimaryGroupAsParentQueue() @Test public void testUserMappingToPrimaryGroupInvalidNestedPlaceholder() - throws YarnException { + throws IOException, YarnException { // u:%user:%primary_group.%random, no matching queue verifyQueueMapping( QueueMappingTestDataBuilder.create() @@ -253,7 +286,7 @@ public void testUserMappingToPrimaryGroupInvalidNestedPlaceholder() @Test public void testUserMappingToSecondaryGroupInvalidNestedPlaceholder() - throws YarnException { + throws IOException, YarnException { // u:%user:%secondary_group.%random, no matching queue verifyQueueMapping( QueueMappingTestDataBuilder.create() @@ -270,7 +303,7 @@ public void testUserMappingToSecondaryGroupInvalidNestedPlaceholder() @Test public void testUserMappingDiffersFromSubmitterQueueDoesNotExist() - throws YarnException { + throws IOException, YarnException { // u:a:%random, submitter: xyz, no matching queue verifyQueueMapping( QueueMappingTestDataBuilder.create() @@ -285,23 +318,24 @@ public void testUserMappingDiffersFromSubmitterQueueDoesNotExist() } @Test - public void testSpecificUserMappingToPrimaryGroup() throws YarnException { + public void testSpecificUserMappingToPrimaryGroup() + throws IOException, YarnException { // u:a:%primary_group verifyQueueMapping( QueueMappingTestDataBuilder.create() .queueMapping(QueueMappingBuilder.create() .type(MappingType.USER) - .source("a") + .source("b") .queue("%primary_group") .build()) - .inputUser("a") - .expectedQueue("agroup") + .inputUser("b") + .expectedQueue("bgroup") .build()); } @Test public void testSpecificUserMappingToSecondaryGroup() - throws YarnException { + throws IOException, YarnException { // u:a:%secondary_group verifyQueueMapping( QueueMappingTestDataBuilder.create() @@ -317,7 +351,7 @@ public void testSpecificUserMappingToSecondaryGroup() @Test public void testSpecificUserMappingWithNoSecondaryGroup() - throws YarnException { + throws IOException, YarnException { // u:nosecondarygroupuser:%secondary_group, no matching queue verifyQueueMapping( QueueMappingTestDataBuilder.create() @@ -333,7 +367,7 @@ public void testSpecificUserMappingWithNoSecondaryGroup() @Test public void testGenericUserMappingWithNoSecondaryGroup() - throws YarnException { + throws IOException, YarnException { // u:%user:%user, no matching queue verifyQueueMapping( QueueMappingTestDataBuilder.create() @@ -350,7 +384,7 @@ public void testGenericUserMappingWithNoSecondaryGroup() @Test public void testUserMappingToNestedUserPrimaryGroupWithAmbiguousQueues() - throws YarnException { + throws IOException, YarnException { // u:%user:%user, submitter nosecondarygroupuser, queue is ambiguous verifyQueueMapping( QueueMappingTestDataBuilder.create() @@ -365,9 +399,9 @@ public void testUserMappingToNestedUserPrimaryGroupWithAmbiguousQueues() .build()); } - @Test(expected = YarnException.class) + @Test public void testResolvedQueueIsNotManaged() - throws YarnException { + throws IOException, YarnException { // u:%user:%primary_group.%user, "admins" group will be "root", // resulting parent queue will be "root" which is not managed verifyQueueMapping( @@ -379,12 +413,13 @@ public void testResolvedQueueIsNotManaged() .parentQueue("%primary_group") .build()) .inputUser("admins") + .expectedQueue("default") .build()); } - @Test(expected = YarnException.class) + @Test public void testUserMappingToPrimaryGroupWithAmbiguousQueues() - throws YarnException { + throws IOException, YarnException { // u:%user:%primary_group, submitter nosecondarygroupuser, // queue is ambiguous verifyQueueMapping( @@ -401,7 +436,7 @@ public void testUserMappingToPrimaryGroupWithAmbiguousQueues() @Test public void testUserMappingToQueueNamedAsUsernameWithSecondaryGroupAsParentQueue() - throws YarnException { + throws IOException, YarnException { verifyQueueMapping( QueueMappingTestDataBuilder.create() .queueMapping(QueueMappingBuilder.create() @@ -417,7 +452,8 @@ public void testUserMappingToQueueNamedAsUsernameWithSecondaryGroupAsParentQueue } @Test - public void testGroupMappingToStaticQueue() throws YarnException { + public void testGroupMappingToStaticQueue() + throws IOException, YarnException { verifyQueueMapping( QueueMappingTestDataBuilder.create() .queueMapping(QueueMappingBuilder.create() @@ -432,7 +468,7 @@ public void testGroupMappingToStaticQueue() throws YarnException { @Test public void testUserMappingToQueueNamedAsGroupNameWithRootAsParentQueue() - throws YarnException { + throws IOException, YarnException { verifyQueueMapping( QueueMappingTestDataBuilder.create() .queueMapping(QueueMappingBuilder.create() @@ -441,15 +477,15 @@ public void testUserMappingToQueueNamedAsGroupNameWithRootAsParentQueue() .queue("%primary_group") .parentQueue("root") .build()) - .inputUser("a") - .expectedQueue("agroup") + .inputUser("b") + .expectedQueue("bgroup") .expectedParentQueue("root") .build()); } @Test public void testUserMappingToPrimaryGroupQueueDoesNotExistUnmanagedParent() - throws YarnException { + throws IOException, YarnException { // "abcgroup" queue doesn't exist, %primary_group queue, not managed parent verifyQueueMapping( QueueMappingTestDataBuilder.create() @@ -466,7 +502,7 @@ public void testUserMappingToPrimaryGroupQueueDoesNotExistUnmanagedParent() @Test public void testUserMappingToPrimaryGroupQueueDoesNotExistManagedParent() - throws YarnException { + throws IOException, YarnException { // "abcgroup" queue doesn't exist, %primary_group queue, managed parent verifyQueueMapping( QueueMappingTestDataBuilder.create() @@ -484,7 +520,7 @@ public void testUserMappingToPrimaryGroupQueueDoesNotExistManagedParent() @Test public void testUserMappingToSecondaryGroupQueueDoesNotExist() - throws YarnException { + throws IOException, YarnException { // "abcgroup" queue doesn't exist, %secondary_group queue verifyQueueMapping( QueueMappingTestDataBuilder.create() @@ -501,7 +537,7 @@ public void testUserMappingToSecondaryGroupQueueDoesNotExist() @Test public void testUserMappingToSecondaryGroupQueueUnderParent() - throws YarnException { + throws IOException, YarnException { // "asubgroup2" queue exists, %secondary_group queue verifyQueueMapping( QueueMappingTestDataBuilder.create() @@ -519,7 +555,7 @@ public void testUserMappingToSecondaryGroupQueueUnderParent() @Test public void testUserMappingToSpecifiedQueueOverwritesInputQueueFromMapping() - throws YarnException { + throws IOException, YarnException { // specify overwritten, and see if user specified a queue, and it will be // overridden verifyQueueMapping( @@ -537,8 +573,9 @@ public void testUserMappingToSpecifiedQueueOverwritesInputQueueFromMapping() } @Test - public void testUserMappingToExplicitlySpecifiedQueue() throws YarnException { - // if overwritten not specified, it should be which user specified + public void testUserMappingToExplicitlySpecifiedQueue() + throws IOException, YarnException { + // if overwritten not specified, it should be which user specified verifyQueueMapping( QueueMappingTestDataBuilder.create() .queueMapping(QueueMappingBuilder.create() @@ -554,7 +591,7 @@ public void testUserMappingToExplicitlySpecifiedQueue() throws YarnException { @Test public void testGroupMappingToExplicitlySpecifiedQueue() - throws YarnException { + throws IOException, YarnException { // if overwritten not specified, it should be which user specified verifyQueueMapping( QueueMappingTestDataBuilder.create() @@ -565,14 +602,14 @@ public void testGroupMappingToExplicitlySpecifiedQueue() .parentQueue("usergroup") .build()) .inputUser("user") - .inputQueue("a") - .expectedQueue("a") + .inputQueue("c") + .expectedQueue("c") .build()); } @Test public void testGroupMappingToSpecifiedQueueOverwritesInputQueueFromMapping() - throws YarnException { + throws IOException, YarnException { // if overwritten not specified, it should be which user specified verifyQueueMapping( QueueMappingTestDataBuilder.create() @@ -591,7 +628,7 @@ public void testGroupMappingToSpecifiedQueueOverwritesInputQueueFromMapping() @Test public void testGroupMappingToSpecifiedQueueUnderAGivenParentQueue() - throws YarnException { + throws IOException, YarnException { // If user specific queue is enabled for a specified group under a given // parent queue verifyQueueMapping( @@ -609,7 +646,7 @@ public void testGroupMappingToSpecifiedQueueUnderAGivenParentQueue() @Test public void testGroupMappingToSpecifiedQueueWithoutParentQueue() - throws YarnException { + throws IOException, YarnException { // If user specific queue is enabled for a specified group without parent // queue verifyQueueMapping(