Explorar el Código

YARN-188. Coverage fixing for CapacityScheduler (Aleksey Gorshkov via bobby)

git-svn-id: https://svn.apache.org/repos/asf/hadoop/common/trunk@1409827 13f79535-47bb-0310-9956-ffa450edef68
Robert Joseph Evans hace 12 años
padre
commit
1dedca8c9a

+ 3 - 0
hadoop-yarn-project/CHANGES.txt

@@ -166,6 +166,9 @@ Release 0.23.6 - UNRELEASED
 
   BUG FIXES
 
+    YARN-188. Coverage fixing for CapacityScheduler (Aleksey Gorshkov via
+    bobby)
+
 Release 0.23.5 - UNRELEASED
 
   INCOMPATIBLE CHANGES

+ 25 - 0
hadoop-yarn-project/hadoop-yarn/hadoop-yarn-server/hadoop-yarn-server-resourcemanager/src/test/java/org/apache/hadoop/yarn/server/resourcemanager/scheduler/capacity/TestCapacityScheduler.java

@@ -30,6 +30,8 @@ import org.apache.commons.logging.LogFactory;
 import org.apache.hadoop.conf.Configuration;
 import org.apache.hadoop.net.NetworkTopology;
 import org.apache.hadoop.yarn.api.records.Priority;
+import org.apache.hadoop.yarn.api.records.QueueInfo;
+import org.apache.hadoop.yarn.api.records.QueueUserACLInfo;
 import org.apache.hadoop.yarn.api.records.Resource;
 import org.apache.hadoop.yarn.conf.YarnConfiguration;
 import org.apache.hadoop.yarn.event.AsyncDispatcher;
@@ -416,5 +418,28 @@ public class TestCapacityScheduler {
       B3_CAPACITY += B4_CAPACITY;
     }
   }
+  @Test
+  public void testCapacitySchedulerInfo() throws Exception {
+    QueueInfo queueInfo = resourceManager.getResourceScheduler().getQueueInfo("a", true, true);
+    Assert.assertEquals(queueInfo.getQueueName(), "a");
+    Assert.assertEquals(queueInfo.getChildQueues().size(), 2);
+
+    List<QueueUserACLInfo> userACLInfo = resourceManager.getResourceScheduler().getQueueUserAclInfo();
+    Assert.assertNotNull(userACLInfo);
+    for (QueueUserACLInfo queueUserACLInfo : userACLInfo) {
+      Assert.assertEquals(getQueueCount(userACLInfo, queueUserACLInfo.getQueueName()), 1);
+    }
+
+  }
+
+  private int getQueueCount(List<QueueUserACLInfo> queueInformation, String queueName) {
+    int result = 0;
+    for (QueueUserACLInfo queueUserACLInfo : queueInformation) {
+      if (queueName.equals(queueUserACLInfo.getQueueName())) {
+        result++;
+      }
+    }
+    return result;
+  }
 
 }