|
@@ -20,6 +20,7 @@ package org.apache.hadoop.yarn.server.resourcemanager.webapp;
|
|
|
|
|
|
import static org.junit.Assert.assertEquals;
|
|
|
import static org.junit.Assert.assertNotNull;
|
|
|
+import static org.junit.Assert.assertFalse;
|
|
|
import static org.junit.Assert.assertTrue;
|
|
|
import static org.junit.Assert.fail;
|
|
|
|
|
@@ -79,6 +80,7 @@ public class TestRMWebServicesCapacitySched extends JerseyTestBase {
|
|
|
int numApplications;
|
|
|
String queueName;
|
|
|
String state;
|
|
|
+ boolean isAbsoluteResource;
|
|
|
}
|
|
|
|
|
|
private class LeafQueueInfo extends QueueInfo {
|
|
@@ -131,6 +133,9 @@ public class TestRMWebServicesCapacitySched extends JerseyTestBase {
|
|
|
final String B = CapacitySchedulerConfiguration.ROOT + ".b";
|
|
|
config.setCapacity(B, 89.5f);
|
|
|
|
|
|
+ final String C = CapacitySchedulerConfiguration.ROOT + ".c";
|
|
|
+ config.setCapacity(C, "[memory=1024]");
|
|
|
+
|
|
|
// Define 2nd-level queues
|
|
|
final String A1 = A + ".a1";
|
|
|
final String A2 = A + ".a2";
|
|
@@ -290,6 +295,8 @@ public class TestRMWebServicesCapacitySched extends JerseyTestBase {
|
|
|
WebServicesTestUtils.getXmlInt(qElem, "numApplications");
|
|
|
qi.queueName = WebServicesTestUtils.getXmlString(qElem, "queueName");
|
|
|
qi.state = WebServicesTestUtils.getXmlString(qElem, "state");
|
|
|
+ qi.isAbsoluteResource = WebServicesTestUtils.getXmlBoolean(qElem,
|
|
|
+ "isAbsoluteResource");
|
|
|
verifySubQueueGeneric(q, qi, parentAbsCapacity, parentAbsMaxCapacity);
|
|
|
if (hasSubQueues) {
|
|
|
for (int j = 0; j < children.getLength(); j++) {
|
|
@@ -384,10 +391,10 @@ public class TestRMWebServicesCapacitySched extends JerseyTestBase {
|
|
|
private void verifySubQueue(JSONObject info, String q,
|
|
|
float parentAbsCapacity, float parentAbsMaxCapacity)
|
|
|
throws JSONException, Exception {
|
|
|
- int numExpectedElements = 24;
|
|
|
+ int numExpectedElements = 25;
|
|
|
boolean isParentQueue = true;
|
|
|
if (!info.has("queues")) {
|
|
|
- numExpectedElements = 42;
|
|
|
+ numExpectedElements = 43;
|
|
|
isParentQueue = false;
|
|
|
}
|
|
|
assertEquals("incorrect number of elements", numExpectedElements, info.length());
|
|
@@ -471,6 +478,14 @@ public class TestRMWebServicesCapacitySched extends JerseyTestBase {
|
|
|
+ " expected: " + q, qshortName.matches(info.queueName));
|
|
|
assertTrue("state doesn't match",
|
|
|
(csConf.getState(q).toString()).matches(info.state));
|
|
|
+ if (q.equals("c")) {
|
|
|
+ assertTrue("c queue is not configured in Absolute resource",
|
|
|
+ info.isAbsoluteResource);
|
|
|
+ } else {
|
|
|
+ assertFalse(info.queueName
|
|
|
+ + " queue is not configured in Absolute resource",
|
|
|
+ info.isAbsoluteResource);
|
|
|
+ }
|
|
|
|
|
|
}
|
|
|
|