|
@@ -458,6 +458,39 @@ public class TestRMWebServicesConfigurationMutation extends JerseyTestBase {
|
|
|
assertEquals("a1", newCSConf.getQueues("root.a")[0]);
|
|
|
}
|
|
|
|
|
|
+ @Test
|
|
|
+ public void testStopWithConvertLeafToParentQueue() throws Exception {
|
|
|
+ WebResource r = resource();
|
|
|
+ ClientResponse response;
|
|
|
+
|
|
|
+ // Set state of queues to STOPPED.
|
|
|
+ SchedConfUpdateInfo updateInfo = new SchedConfUpdateInfo();
|
|
|
+ Map<String, String> stoppedParam = new HashMap<>();
|
|
|
+ stoppedParam.put(CapacitySchedulerConfiguration.STATE,
|
|
|
+ QueueState.STOPPED.toString());
|
|
|
+ QueueConfigInfo stoppedInfo = new QueueConfigInfo("root.b",
|
|
|
+ stoppedParam);
|
|
|
+ updateInfo.getUpdateQueueInfo().add(stoppedInfo);
|
|
|
+
|
|
|
+ Map<String, String> b1Capacity = new HashMap<>();
|
|
|
+ b1Capacity.put(CapacitySchedulerConfiguration.CAPACITY, "100");
|
|
|
+ QueueConfigInfo b1 = new QueueConfigInfo("root.b.b1", b1Capacity);
|
|
|
+ updateInfo.getAddQueueInfo().add(b1);
|
|
|
+
|
|
|
+ response = r.path("ws").path("v1").path("cluster")
|
|
|
+ .path("scheduler-conf").queryParam("user.name", userName)
|
|
|
+ .accept(MediaType.APPLICATION_JSON)
|
|
|
+ .entity(YarnWebServiceUtils.toJson(updateInfo,
|
|
|
+ SchedConfUpdateInfo.class), MediaType.APPLICATION_JSON)
|
|
|
+ .put(ClientResponse.class);
|
|
|
+
|
|
|
+ assertEquals(Status.OK.getStatusCode(), response.getStatus());
|
|
|
+ CapacitySchedulerConfiguration newCSConf =
|
|
|
+ ((CapacityScheduler) rm.getResourceScheduler()).getConfiguration();
|
|
|
+ assertEquals(1, newCSConf.getQueues("root.b").length);
|
|
|
+ assertEquals("b1", newCSConf.getQueues("root.b")[0]);
|
|
|
+ }
|
|
|
+
|
|
|
@Test
|
|
|
public void testRemoveParentQueue() throws Exception {
|
|
|
WebResource r = resource();
|