|
@@ -1590,4 +1590,27 @@ public class TestYarnCLI {
|
|
|
private static String normalize(String s) {
|
|
|
return SPACES_PATTERN.matcher(s).replaceAll(" "); // single space
|
|
|
}
|
|
|
+
|
|
|
+ @Test
|
|
|
+ public void testAppAttemptReportWhileContainerIsNotAssigned()
|
|
|
+ throws Exception {
|
|
|
+ ApplicationCLI cli = createAndGetAppCLI();
|
|
|
+ ApplicationId applicationId = ApplicationId.newInstance(1234, 5);
|
|
|
+ ApplicationAttemptId attemptId =
|
|
|
+ ApplicationAttemptId.newInstance(applicationId, 1);
|
|
|
+ ApplicationAttemptReport attemptReport =
|
|
|
+ ApplicationAttemptReport.newInstance(attemptId, "host", 124, "url",
|
|
|
+ "oUrl", "diagnostics", YarnApplicationAttemptState.SCHEDULED, null,
|
|
|
+ 1000l, 2000l);
|
|
|
+ when(client.getApplicationAttemptReport(any(ApplicationAttemptId.class)))
|
|
|
+ .thenReturn(attemptReport);
|
|
|
+ int result =
|
|
|
+ cli.run(new String[] { "applicationattempt", "-status",
|
|
|
+ attemptId.toString() });
|
|
|
+ assertEquals(0, result);
|
|
|
+ result =
|
|
|
+ cli.run(new String[] { "applicationattempt", "-list",
|
|
|
+ applicationId.toString() });
|
|
|
+ assertEquals(0, result);
|
|
|
+ }
|
|
|
}
|