YARN-5550. TestYarnCLI#testGetContainers should format according to CONTAINER_PATTERN. Contributed by Jonathan Hung.
(cherry picked from commited6ff5cd78
) (cherry picked from commit3ad4f0823c
) (cherry picked from commit765139e4da
)
This commit is contained in:
parent
4fd2adbc5f
commit
32a86f199c
|
@ -62,14 +62,17 @@ public class ApplicationCLI extends YarnCLI {
|
||||||
private static final String APPLICATION_ATTEMPTS_PATTERN =
|
private static final String APPLICATION_ATTEMPTS_PATTERN =
|
||||||
"%30s\t%20s\t%35s\t%35s"
|
"%30s\t%20s\t%35s\t%35s"
|
||||||
+ System.getProperty("line.separator");
|
+ System.getProperty("line.separator");
|
||||||
private static final String CONTAINER_PATTERN =
|
|
||||||
"%30s\t%20s\t%20s\t%20s\t%20s\t%20s\t%35s"
|
|
||||||
+ System.getProperty("line.separator");
|
|
||||||
|
|
||||||
private static final String APP_TYPE_CMD = "appTypes";
|
private static final String APP_TYPE_CMD = "appTypes";
|
||||||
private static final String APP_STATE_CMD = "appStates";
|
private static final String APP_STATE_CMD = "appStates";
|
||||||
private static final String ALLSTATES_OPTION = "ALL";
|
private static final String ALLSTATES_OPTION = "ALL";
|
||||||
private static final String QUEUE_CMD = "queue";
|
private static final String QUEUE_CMD = "queue";
|
||||||
|
|
||||||
|
@VisibleForTesting
|
||||||
|
protected static final String CONTAINER_PATTERN =
|
||||||
|
"%30s\t%20s\t%20s\t%20s\t%20s\t%20s\t%35s"
|
||||||
|
+ System.getProperty("line.separator");
|
||||||
|
|
||||||
public static final String APPLICATION = "application";
|
public static final String APPLICATION = "application";
|
||||||
public static final String APPLICATION_ATTEMPT = "applicationattempt";
|
public static final String APPLICATION_ATTEMPT = "applicationattempt";
|
||||||
public static final String CONTAINER = "container";
|
public static final String CONTAINER = "container";
|
||||||
|
|
|
@ -286,34 +286,17 @@ public class TestYarnCLI {
|
||||||
ByteArrayOutputStream baos = new ByteArrayOutputStream();
|
ByteArrayOutputStream baos = new ByteArrayOutputStream();
|
||||||
PrintWriter pw = new PrintWriter(baos);
|
PrintWriter pw = new PrintWriter(baos);
|
||||||
pw.println("Total number of containers :3");
|
pw.println("Total number of containers :3");
|
||||||
pw.print(" Container-Id");
|
pw.printf(ApplicationCLI.CONTAINER_PATTERN, "Container-Id", "Start Time",
|
||||||
pw.print("\t Start Time");
|
"Finish Time", "State", "Host", "Node Http Address", "LOG-URL");
|
||||||
pw.print("\t Finish Time");
|
pw.printf(ApplicationCLI.CONTAINER_PATTERN, "container_1234_0005_01_000001",
|
||||||
pw.print("\t State");
|
dateFormat.format(new Date(time1)), dateFormat.format(new Date(time2)),
|
||||||
pw.print("\t Host");
|
"COMPLETE", "host:1234", "http://host:2345", "logURL");
|
||||||
pw.print("\t Node Http Address");
|
pw.printf(ApplicationCLI.CONTAINER_PATTERN, "container_1234_0005_01_000002",
|
||||||
pw.println("\t LOG-URL");
|
dateFormat.format(new Date(time1)), dateFormat.format(new Date(time2)),
|
||||||
pw.print(" container_1234_0005_01_000001");
|
"COMPLETE", "host:1234", "http://host:2345", "logURL");
|
||||||
pw.print("\t"+dateFormat.format(new Date(time1)));
|
pw.printf(ApplicationCLI.CONTAINER_PATTERN, "container_1234_0005_01_000003",
|
||||||
pw.print("\t"+dateFormat.format(new Date(time2)));
|
dateFormat.format(new Date(time1)), "N/A", "RUNNING", "host:1234",
|
||||||
pw.print("\t COMPLETE");
|
"http://host:2345", "");
|
||||||
pw.print("\t host:1234");
|
|
||||||
pw.print("\t http://host:2345");
|
|
||||||
pw.println("\t logURL");
|
|
||||||
pw.print(" container_1234_0005_01_000002");
|
|
||||||
pw.print("\t"+dateFormat.format(new Date(time1)));
|
|
||||||
pw.print("\t"+dateFormat.format(new Date(time2)));
|
|
||||||
pw.print("\t COMPLETE");
|
|
||||||
pw.print("\t host:1234");
|
|
||||||
pw.print("\t http://host:2345");
|
|
||||||
pw.println("\t logURL");
|
|
||||||
pw.print(" container_1234_0005_01_000003");
|
|
||||||
pw.print("\t"+dateFormat.format(new Date(time1)));
|
|
||||||
pw.print("\t N/A");
|
|
||||||
pw.print("\t RUNNING");
|
|
||||||
pw.print("\t host:1234");
|
|
||||||
pw.print("\t http://host:2345");
|
|
||||||
pw.println("\t ");
|
|
||||||
pw.close();
|
pw.close();
|
||||||
String appReportStr = baos.toString("UTF-8");
|
String appReportStr = baos.toString("UTF-8");
|
||||||
Log.info("ExpectedOutput");
|
Log.info("ExpectedOutput");
|
||||||
|
|
Loading…
Reference in New Issue