akshatb1 commented on a change in pull request #3252:
URL: https://github.com/apache/hadoop/pull/3252#discussion_r702907441



##########
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
##########
@@ -124,6 +124,49 @@ public void testMergeUnmanagedApplications() {
     Assert.assertTrue(result.getApplicationList().isEmpty());
   }
 
+  /**
+   * This test validates the correctness of
+   * RouterYarnClientUtils#mergeApplications when
+   * ApplicationResourceUsageReport might be null.
+   */
+  @Test
+  public void testMergeApplicationsNullResourceUsage() {
+    ApplicationId appId = ApplicationId.newInstance(1234, 1);
+    ApplicationReport appReport = ApplicationReport.newInstance(
+            appId, ApplicationAttemptId.newInstance(appId, 1),
+            "user", "queue", "app1", "host",
+            124, null, YarnApplicationState.RUNNING,
+            "diagnostics", "url", 0, 0,
+            0, FinalApplicationStatus.SUCCEEDED, null, "N/A",
+            0.53789f, "YARN", null, null, false, null, null, null);
+
+    ApplicationReport uamAppReport = ApplicationReport.newInstance(
+            appId, ApplicationAttemptId.newInstance(appId, 1),
+            "user", "queue", "app1", "host",
+            124, null, YarnApplicationState.RUNNING,
+            "diagnostics", "url", 0, 0,
+            0, FinalApplicationStatus.SUCCEEDED, null, "N/A",
+            0.53789f, "YARN", null, null, true, null, null, null);
+
+
+    ArrayList<GetApplicationsResponse> responses = new ArrayList<>();
+    List<ApplicationReport> applications = new ArrayList<>();
+    applications.add(appReport);
+    applications.add(uamAppReport);
+    responses.add(GetApplicationsResponse.newInstance(applications));
+
+    GetApplicationsResponse result = RouterYarnClientUtils.
+            mergeApplications(responses, false);
+    Assert.assertNotNull(result);
+    Assert.assertEquals(1, result.getApplicationList().size());
+
+    String appName = result.getApplicationList().get(0).getName();
+
+    // Check that no Unmanaged applications are added to the result
+    Assert.assertEquals(false,

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.

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]

Reply via email to