slfan1989 commented on code in PR #4464:
URL: https://github.com/apache/hadoop/pull/4464#discussion_r909023810
##########
hadoop-yarn-project/hadoop-yarn/hadoop-yarn-server/hadoop-yarn-server-router/src/test/java/org/apache/hadoop/yarn/server/router/clientrm/TestFederationClientInterceptor.java:
##########
@@ -1101,4 +1106,67 @@ public void testSignalContainer() throws Exception {
Assert.assertNotNull(signalContainerResponse);
}
+
+ @Test
+ public void testMoveApplicationAcrossQueues() throws Exception {
+ LOG.info("Test FederationClientInterceptor : MoveApplication AcrossQueues
request.");
+
+ // null request
+ LambdaTestUtils.intercept(YarnException.class, "Missing
moveApplicationAcrossQueues request " +
+ "or applicationId or target queue.", () ->
interceptor.moveApplicationAcrossQueues(null));
+
+ // normal request
+ ApplicationId appId =
ApplicationId.newInstance(System.currentTimeMillis(), 1);
+ SubmitApplicationRequest request = mockSubmitApplicationRequest(appId);
+
+ // Submit the application
+ SubmitApplicationResponse response =
interceptor.submitApplication(request);
+
+ Assert.assertNotNull(response);
+ Assert.assertNotNull(stateStoreUtil.queryApplicationHomeSC(appId));
+
+ SubClusterId subClusterId =
interceptor.getApplicationHomeSubCluster(appId);
+ Assert.assertNotNull(subClusterId);
+
+ MockRM mockRM = interceptor.getMockRMs().get(subClusterId);
+ mockRM.waitForState(appId, RMAppState.ACCEPTED);
+ RMApp rmApp = mockRM.getRMContext().getRMApps().get(appId);
+ mockRM.waitForState(rmApp.getCurrentAppAttempt().getAppAttemptId(),
+ RMAppAttemptState.SCHEDULED);
+ MockNM nm = interceptor.getMockNMs().get(subClusterId);
+ nm.nodeHeartbeat(true);
+ mockRM.waitForState(rmApp.getCurrentAppAttempt(),
RMAppAttemptState.ALLOCATED);
+ mockRM.sendAMLaunched(rmApp.getCurrentAppAttempt().getAppAttemptId());
+
+ MoveApplicationAcrossQueuesRequest acrossQueuesRequest =
+ MoveApplicationAcrossQueuesRequest.newInstance(appId,"root.target");
Review Comment:
Thanks for your help reviewing the code, I will fix it.
##########
hadoop-yarn-project/hadoop-yarn/hadoop-yarn-server/hadoop-yarn-server-router/src/test/java/org/apache/hadoop/yarn/server/router/clientrm/TestFederationClientInterceptor.java:
##########
@@ -1101,4 +1106,67 @@ public void testSignalContainer() throws Exception {
Assert.assertNotNull(signalContainerResponse);
}
+
+ @Test
+ public void testMoveApplicationAcrossQueues() throws Exception {
+ LOG.info("Test FederationClientInterceptor : MoveApplication AcrossQueues
request.");
+
+ // null request
+ LambdaTestUtils.intercept(YarnException.class, "Missing
moveApplicationAcrossQueues request " +
+ "or applicationId or target queue.", () ->
interceptor.moveApplicationAcrossQueues(null));
+
+ // normal request
+ ApplicationId appId =
ApplicationId.newInstance(System.currentTimeMillis(), 1);
+ SubmitApplicationRequest request = mockSubmitApplicationRequest(appId);
+
+ // Submit the application
+ SubmitApplicationResponse response =
interceptor.submitApplication(request);
+
+ Assert.assertNotNull(response);
+ Assert.assertNotNull(stateStoreUtil.queryApplicationHomeSC(appId));
+
+ SubClusterId subClusterId =
interceptor.getApplicationHomeSubCluster(appId);
+ Assert.assertNotNull(subClusterId);
+
+ MockRM mockRM = interceptor.getMockRMs().get(subClusterId);
+ mockRM.waitForState(appId, RMAppState.ACCEPTED);
+ RMApp rmApp = mockRM.getRMContext().getRMApps().get(appId);
+ mockRM.waitForState(rmApp.getCurrentAppAttempt().getAppAttemptId(),
+ RMAppAttemptState.SCHEDULED);
+ MockNM nm = interceptor.getMockNMs().get(subClusterId);
+ nm.nodeHeartbeat(true);
+ mockRM.waitForState(rmApp.getCurrentAppAttempt(),
RMAppAttemptState.ALLOCATED);
+ mockRM.sendAMLaunched(rmApp.getCurrentAppAttempt().getAppAttemptId());
+
+ MoveApplicationAcrossQueuesRequest acrossQueuesRequest =
+ MoveApplicationAcrossQueuesRequest.newInstance(appId,"root.target");
+ MoveApplicationAcrossQueuesResponse acrossQueuesResponse =
+ interceptor.moveApplicationAcrossQueues(acrossQueuesRequest);
+
+ Assert.assertNotNull(acrossQueuesResponse);
+ }
+
+
+ @Test
+ public void testGetQueueInfo() throws Exception {
+ LOG.info("Test FederationClientInterceptor : Get Queue Info request.");
+
+ // null request
+ LambdaTestUtils.intercept(YarnException.class, "Missing getQueueInfo
request or queueName.",
+ () -> interceptor.getQueueInfo(null));
+
+ // normal request
+ GetQueueInfoResponse response = interceptor.getQueueInfo(
+ GetQueueInfoRequest.newInstance("root", true, true, true));
+
+ Assert.assertNotNull(response);
+
+ QueueInfo queueInfo = response.getQueueInfo();
+ Assert.assertNotNull(queueInfo);
+ Assert.assertEquals(queueInfo.getQueueName(), "root");
+ Assert.assertEquals(queueInfo.getCapacity(), 4.0, 0);
+ Assert.assertEquals(queueInfo.getCurrentCapacity(), 0.0,0);
Review Comment:
I will fix it.
--
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]