slfan1989 commented on code in PR #6132:
URL: https://github.com/apache/hadoop/pull/6132#discussion_r1357707184
##########
hadoop-yarn-project/hadoop-yarn/hadoop-yarn-client/src/test/java/org/apache/hadoop/yarn/client/cli/TestYarnCLI.java:
##########
@@ -1969,6 +1971,98 @@ public void testGetQueueInfoWithEmptyNodeLabel() throws
Exception {
String queueInfoStr = baos.toString("UTF-8");
Assert.assertEquals(queueInfoStr, sysOutStream.toString());
}
+
+ @Test
+ public void testGetQueueInfoWithFairScheduler() throws Exception {
+ // In this test case, we will simulate the queue information of
fairScheduler
+ // and check the results of the queue information.
+ QueueCLI cli = createAndGetQueueCLI();
+ RecordFactory recordFactory = RecordFactoryProvider.getRecordFactory(null);
+ QueueInfo queueInfo = recordFactory.newRecordInstance(QueueInfo.class);
+ queueInfo.setQueueName("queueA");
+ queueInfo.setSchedulerType("FairScheduler");
+ queueInfo.setQueueState(QueueState.RUNNING);
+ queueInfo.setCapacity(0.3f);
+ queueInfo.setCurrentCapacity(0.1f);
+ queueInfo.setWeight(0.3f);
+ queueInfo.setMinResourceVCore(1);
+ queueInfo.setMinResourceMemory(1024);
+ queueInfo.setMaxResourceVCore(10);
+ queueInfo.setMaxResourceMemory(8192);
+ queueInfo.setReservedResourceVCore(0);
+ queueInfo.setReservedResourceMemory(0);
+ queueInfo.setSteadyFairShareVCore(10);
+ queueInfo.setSteadyFairShareMemory(8192);
+ queueInfo.setMaxRunningApp(10);
+ queueInfo.setPreemptionDisabled(true);
+ when(client.getQueueInfo(any(String.class))).thenReturn(queueInfo);
+ int result = cli.run(new String[] { "-status", "queueA" });
+ assertEquals(0, result);
+ verify(client).getQueueInfo("queueA");
+ ByteArrayOutputStream baos = new ByteArrayOutputStream();
+ PrintWriter pw = new PrintWriter(baos);
+ pw.println("Queue Information : ");
+ pw.println("Scheduler Name : FairScheduler");
+ pw.println("Queue Name : " + "queueA");
+ pw.println("\tWeight : " + "0.30");
+ pw.println("\tState : " + "RUNNING");
+ pw.println("\tMinResource : " + "<memory : 0, vCores:10>");
+ pw.println("\tMaxResource : " + "<memory : 8192, vCores:0>");
Review Comment:
Thank you very much for your help in reviewing the code! I wrote this unit
test based on the original unit test. I will improve this part of the code.
--
This is an automated message from the Apache Git Service.
To respond to the message, please log on to GitHub and use the
URL above to go to the specific comment.
To unsubscribe, e-mail: [email protected]
For queries about this service, please contact Infrastructure at:
[email protected]
---------------------------------------------------------------------
To unsubscribe, e-mail: [email protected]
For additional commands, e-mail: [email protected]