akshatb1 commented on a change in pull request #3135:
URL: https://github.com/apache/hadoop/pull/3135#discussion_r658479600
##########
File path:
hadoop-yarn-project/hadoop-yarn/hadoop-yarn-server/hadoop-yarn-server-router/src/test/java/org/apache/hadoop/yarn/server/router/clientrm/TestRouterYarnClientUtils.java
##########
@@ -54,4 +64,62 @@ public GetClusterMetricsResponse
getClusterMetricsResponse(int value) {
metrics.setNumNodeManagers(value);
return GetClusterMetricsResponse.newInstance(metrics);
}
+
+ /**
+ * This test validates the correctness of
+ * RouterYarnClientUtils#mergeApplications.
+ */
+ @Test
+ public void testMergeApplications() {
+ ArrayList<GetApplicationsResponse> responses = new ArrayList<>();
+ responses.add(getApplicationsResponse(1));
+ responses.add(getApplicationsResponse(2));
+ GetApplicationsResponse result = RouterYarnClientUtils.
+ mergeApplications(responses, false);
+ Assert.assertNotNull(result);
+ Assert.assertEquals(2, result.getApplicationList().size());
+ }
+
+ private GetApplicationsResponse getApplicationsResponse(int value) {
+ List<ApplicationReport> applications = new ArrayList<>();
+
+ //Add managed application to list
+ ApplicationId applicationId = ApplicationId.newInstance(1234,
+ value);
+ Resource resource = Resource.newInstance(1024, 1);
+ ApplicationResourceUsageReport appResourceUsageReport =
+ ApplicationResourceUsageReport.newInstance(
+ 1, 2, resource, resource,
+ resource, null, 0.1f,
+ 0.1f, null);
+
+ ApplicationReport newApplicationReport = ApplicationReport.newInstance(
+ applicationId, ApplicationAttemptId.newInstance(applicationId,
+ 1),
+ "user", "queue", "appname", "host",
+ 124, null, YarnApplicationState.RUNNING,
+ "diagnostics", "url", 0, 0,
+ 0, FinalApplicationStatus.SUCCEEDED,
+ appResourceUsageReport,
+ "N/A", 0.53789f, "YARN",
+ null);
+
+ //Add unmanaged application to list
+ ApplicationId applicationId2 = ApplicationId.newInstance(1234,
Review comment:
Done.
--
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.
For queries about this service, please contact Infrastructure at:
[email protected]
---------------------------------------------------------------------
To unsubscribe, e-mail: [email protected]
For additional commands, e-mail: [email protected]