|
@@ -20,7 +20,11 @@ package org.apache.hadoop.yarn.client.cli;
|
|
import org.apache.hadoop.yarn.api.records.NodeAttribute;
|
|
import org.apache.hadoop.yarn.api.records.NodeAttribute;
|
|
import org.apache.hadoop.yarn.api.records.NodeAttributeType;
|
|
import org.apache.hadoop.yarn.api.records.NodeAttributeType;
|
|
import static org.assertj.core.api.Assertions.assertThat;
|
|
import static org.assertj.core.api.Assertions.assertThat;
|
|
-import static org.junit.Assert.assertEquals;
|
|
|
|
|
|
+import static org.junit.jupiter.api.Assertions.assertEquals;
|
|
|
|
+import static org.junit.jupiter.api.Assertions.assertNotSame;
|
|
|
|
+import static org.junit.jupiter.api.Assertions.assertNotEquals;
|
|
|
|
+import static org.junit.jupiter.api.Assertions.assertTrue;
|
|
|
|
+import static org.junit.jupiter.api.Assertions.fail;
|
|
import static org.mockito.ArgumentMatchers.any;
|
|
import static org.mockito.ArgumentMatchers.any;
|
|
import static org.mockito.ArgumentMatchers.anyInt;
|
|
import static org.mockito.ArgumentMatchers.anyInt;
|
|
import static org.mockito.ArgumentMatchers.isA;
|
|
import static org.mockito.ArgumentMatchers.isA;
|
|
@@ -99,9 +103,9 @@ import org.apache.hadoop.yarn.server.resourcemanager.scheduler.capacity.Capacity
|
|
import org.apache.hadoop.yarn.util.Records;
|
|
import org.apache.hadoop.yarn.util.Records;
|
|
import org.apache.hadoop.yarn.util.Times;
|
|
import org.apache.hadoop.yarn.util.Times;
|
|
import static org.apache.hadoop.yarn.server.resourcemanager.scheduler.capacity.CapacitySchedulerConfiguration.PREFIX;
|
|
import static org.apache.hadoop.yarn.server.resourcemanager.scheduler.capacity.CapacitySchedulerConfiguration.PREFIX;
|
|
-import org.junit.Assert;
|
|
|
|
-import org.junit.Before;
|
|
|
|
-import org.junit.Test;
|
|
|
|
|
|
+import org.junit.jupiter.api.BeforeEach;
|
|
|
|
+import org.junit.jupiter.api.Test;
|
|
|
|
+import org.junit.jupiter.api.Timeout;
|
|
import org.eclipse.jetty.util.log.Log;
|
|
import org.eclipse.jetty.util.log.Log;
|
|
|
|
|
|
import org.slf4j.Logger;
|
|
import org.slf4j.Logger;
|
|
@@ -119,7 +123,7 @@ public class TestYarnCLI {
|
|
private static final Pattern SPACES_PATTERN =
|
|
private static final Pattern SPACES_PATTERN =
|
|
Pattern.compile("\\s+|\\n+|\\t+");
|
|
Pattern.compile("\\s+|\\n+|\\t+");
|
|
|
|
|
|
- @Before
|
|
|
|
|
|
+ @BeforeEach
|
|
public void setup() {
|
|
public void setup() {
|
|
sysOutStream = new ByteArrayOutputStream();
|
|
sysOutStream = new ByteArrayOutputStream();
|
|
sysOut = spy(new PrintStream(sysOutStream));
|
|
sysOut = spy(new PrintStream(sysOutStream));
|
|
@@ -197,7 +201,7 @@ public class TestYarnCLI {
|
|
pw.println();
|
|
pw.println();
|
|
pw.close();
|
|
pw.close();
|
|
String appReportStr = baos.toString("UTF-8");
|
|
String appReportStr = baos.toString("UTF-8");
|
|
- Assert.assertEquals(appReportStr, sysOutStream.toString());
|
|
|
|
|
|
+ assertEquals(appReportStr, sysOutStream.toString());
|
|
sysOutStream.reset();
|
|
sysOutStream.reset();
|
|
verify(sysOut, times(1 + i)).println(isA(String.class));
|
|
verify(sysOut, times(1 + i)).println(isA(String.class));
|
|
}
|
|
}
|
|
@@ -233,7 +237,7 @@ public class TestYarnCLI {
|
|
pw.println("\tDiagnostics : diagnostics");
|
|
pw.println("\tDiagnostics : diagnostics");
|
|
pw.close();
|
|
pw.close();
|
|
String appReportStr = baos.toString("UTF-8");
|
|
String appReportStr = baos.toString("UTF-8");
|
|
- Assert.assertEquals(appReportStr, sysOutStream.toString());
|
|
|
|
|
|
+ assertEquals(appReportStr, sysOutStream.toString());
|
|
verify(sysOut, times(1)).println(isA(String.class));
|
|
verify(sysOut, times(1)).println(isA(String.class));
|
|
}
|
|
}
|
|
|
|
|
|
@@ -279,7 +283,7 @@ public class TestYarnCLI {
|
|
pw.println("\t url");
|
|
pw.println("\t url");
|
|
pw.close();
|
|
pw.close();
|
|
String appReportStr = baos.toString("UTF-8");
|
|
String appReportStr = baos.toString("UTF-8");
|
|
- Assert.assertEquals(appReportStr, sysOutStream.toString());
|
|
|
|
|
|
+ assertEquals(appReportStr, sysOutStream.toString());
|
|
}
|
|
}
|
|
|
|
|
|
@Test
|
|
@Test
|
|
@@ -322,7 +326,7 @@ public class TestYarnCLI {
|
|
pw.close();
|
|
pw.close();
|
|
String appReportStr = baos.toString("UTF-8");
|
|
String appReportStr = baos.toString("UTF-8");
|
|
|
|
|
|
- Assert.assertEquals(appReportStr, sysOutStream.toString());
|
|
|
|
|
|
+ assertEquals(appReportStr, sysOutStream.toString());
|
|
verify(sysOut, times(1)).println(isA(String.class));
|
|
verify(sysOut, times(1)).println(isA(String.class));
|
|
}
|
|
}
|
|
|
|
|
|
@@ -386,7 +390,7 @@ public class TestYarnCLI {
|
|
Log.getLog().info("OutputFrom command");
|
|
Log.getLog().info("OutputFrom command");
|
|
String actualOutput = sysOutStream.toString("UTF-8");
|
|
String actualOutput = sysOutStream.toString("UTF-8");
|
|
Log.getLog().info("["+actualOutput+"]");
|
|
Log.getLog().info("["+actualOutput+"]");
|
|
- Assert.assertEquals(appReportStr, actualOutput);
|
|
|
|
|
|
+ assertEquals(appReportStr, actualOutput);
|
|
}
|
|
}
|
|
|
|
|
|
@Test
|
|
@Test
|
|
@@ -401,7 +405,7 @@ public class TestYarnCLI {
|
|
verify(sysOut).println(
|
|
verify(sysOut).println(
|
|
"Application with id '" + applicationId
|
|
"Application with id '" + applicationId
|
|
+ "' doesn't exist in RM or Timeline Server.");
|
|
+ "' doesn't exist in RM or Timeline Server.");
|
|
- Assert.assertNotSame("should return non-zero exit code.", 0, exitCode);
|
|
|
|
|
|
+ assertNotSame(0, exitCode, "should return non-zero exit code.");
|
|
}
|
|
}
|
|
|
|
|
|
@Test
|
|
@Test
|
|
@@ -516,7 +520,7 @@ public class TestYarnCLI {
|
|
pw.println("\t N/A");
|
|
pw.println("\t N/A");
|
|
pw.close();
|
|
pw.close();
|
|
String appsReportStr = baos.toString("UTF-8");
|
|
String appsReportStr = baos.toString("UTF-8");
|
|
- Assert.assertEquals(appsReportStr, sysOutStream.toString());
|
|
|
|
|
|
+ assertEquals(appsReportStr, sysOutStream.toString());
|
|
verify(sysOut, times(1)).write(any(byte[].class), anyInt(), anyInt());
|
|
verify(sysOut, times(1)).write(any(byte[].class), anyInt(), anyInt());
|
|
|
|
|
|
//Test command yarn application -list --appTypes apptype1,apptype2
|
|
//Test command yarn application -list --appTypes apptype1,apptype2
|
|
@@ -557,7 +561,7 @@ public class TestYarnCLI {
|
|
pw.println("\t N/A");
|
|
pw.println("\t N/A");
|
|
pw.close();
|
|
pw.close();
|
|
appsReportStr = baos.toString("UTF-8");
|
|
appsReportStr = baos.toString("UTF-8");
|
|
- Assert.assertEquals(appsReportStr, sysOutStream.toString());
|
|
|
|
|
|
+ assertEquals(appsReportStr, sysOutStream.toString());
|
|
verify(sysOut, times(2)).write(any(byte[].class), anyInt(), anyInt());
|
|
verify(sysOut, times(2)).write(any(byte[].class), anyInt(), anyInt());
|
|
|
|
|
|
//Test command yarn application -list --appStates appState1,appState2
|
|
//Test command yarn application -list --appStates appState1,appState2
|
|
@@ -598,7 +602,7 @@ public class TestYarnCLI {
|
|
pw.println("\t N/A");
|
|
pw.println("\t N/A");
|
|
pw.close();
|
|
pw.close();
|
|
appsReportStr = baos.toString("UTF-8");
|
|
appsReportStr = baos.toString("UTF-8");
|
|
- Assert.assertEquals(appsReportStr, sysOutStream.toString());
|
|
|
|
|
|
+ assertEquals(appsReportStr, sysOutStream.toString());
|
|
verify(sysOut, times(3)).write(any(byte[].class), anyInt(), anyInt());
|
|
verify(sysOut, times(3)).write(any(byte[].class), anyInt(), anyInt());
|
|
|
|
|
|
// Test command yarn application -list --appTypes apptype1,apptype2
|
|
// Test command yarn application -list --appTypes apptype1,apptype2
|
|
@@ -637,7 +641,7 @@ public class TestYarnCLI {
|
|
pw.println("\t N/A");
|
|
pw.println("\t N/A");
|
|
pw.close();
|
|
pw.close();
|
|
appsReportStr = baos.toString("UTF-8");
|
|
appsReportStr = baos.toString("UTF-8");
|
|
- Assert.assertEquals(appsReportStr, sysOutStream.toString());
|
|
|
|
|
|
+ assertEquals(appsReportStr, sysOutStream.toString());
|
|
verify(sysOut, times(4)).write(any(byte[].class), anyInt(), anyInt());
|
|
verify(sysOut, times(4)).write(any(byte[].class), anyInt(), anyInt());
|
|
|
|
|
|
//Test command yarn application -list --appStates with invalid appStates
|
|
//Test command yarn application -list --appStates with invalid appStates
|
|
@@ -659,7 +663,7 @@ public class TestYarnCLI {
|
|
pw.println(output.substring(0, output.length()-1));
|
|
pw.println(output.substring(0, output.length()-1));
|
|
pw.close();
|
|
pw.close();
|
|
appsReportStr = baos.toString("UTF-8");
|
|
appsReportStr = baos.toString("UTF-8");
|
|
- Assert.assertEquals(appsReportStr, sysOutStream.toString());
|
|
|
|
|
|
+ assertEquals(appsReportStr, sysOutStream.toString());
|
|
verify(sysOut, times(4)).write(any(byte[].class), anyInt(), anyInt());
|
|
verify(sysOut, times(4)).write(any(byte[].class), anyInt(), anyInt());
|
|
|
|
|
|
//Test command yarn application -list --appStates all
|
|
//Test command yarn application -list --appStates all
|
|
@@ -718,7 +722,7 @@ public class TestYarnCLI {
|
|
pw.println("\t N/A");
|
|
pw.println("\t N/A");
|
|
pw.close();
|
|
pw.close();
|
|
appsReportStr = baos.toString("UTF-8");
|
|
appsReportStr = baos.toString("UTF-8");
|
|
- Assert.assertEquals(appsReportStr, sysOutStream.toString());
|
|
|
|
|
|
+ assertEquals(appsReportStr, sysOutStream.toString());
|
|
verify(sysOut, times(5)).write(any(byte[].class), anyInt(), anyInt());
|
|
verify(sysOut, times(5)).write(any(byte[].class), anyInt(), anyInt());
|
|
|
|
|
|
// Test command yarn application user case insensitive
|
|
// Test command yarn application user case insensitive
|
|
@@ -754,7 +758,7 @@ public class TestYarnCLI {
|
|
pw.println("\t N/A");
|
|
pw.println("\t N/A");
|
|
pw.close();
|
|
pw.close();
|
|
appsReportStr = baos.toString("UTF-8");
|
|
appsReportStr = baos.toString("UTF-8");
|
|
- Assert.assertEquals(appsReportStr, sysOutStream.toString());
|
|
|
|
|
|
+ assertEquals(appsReportStr, sysOutStream.toString());
|
|
verify(sysOut, times(6)).write(any(byte[].class), anyInt(), anyInt());
|
|
verify(sysOut, times(6)).write(any(byte[].class), anyInt(), anyInt());
|
|
|
|
|
|
// Test command yarn application with tags.
|
|
// Test command yarn application with tags.
|
|
@@ -788,7 +792,7 @@ public class TestYarnCLI {
|
|
pw.println("\t N/A");
|
|
pw.println("\t N/A");
|
|
pw.close();
|
|
pw.close();
|
|
appsReportStr = baos.toString("UTF-8");
|
|
appsReportStr = baos.toString("UTF-8");
|
|
- Assert.assertEquals(appsReportStr, sysOutStream.toString());
|
|
|
|
|
|
+ assertEquals(appsReportStr, sysOutStream.toString());
|
|
verify(sysOut, times(7)).write(any(byte[].class), anyInt(), anyInt());
|
|
verify(sysOut, times(7)).write(any(byte[].class), anyInt(), anyInt());
|
|
|
|
|
|
sysOutStream.reset();
|
|
sysOutStream.reset();
|
|
@@ -828,7 +832,7 @@ public class TestYarnCLI {
|
|
pw.println("\t N/A");
|
|
pw.println("\t N/A");
|
|
pw.close();
|
|
pw.close();
|
|
appsReportStr = baos.toString("UTF-8");
|
|
appsReportStr = baos.toString("UTF-8");
|
|
- Assert.assertEquals(appsReportStr, sysOutStream.toString());
|
|
|
|
|
|
+ assertEquals(appsReportStr, sysOutStream.toString());
|
|
verify(sysOut, times(8)).write(any(byte[].class), anyInt(), anyInt());
|
|
verify(sysOut, times(8)).write(any(byte[].class), anyInt(), anyInt());
|
|
|
|
|
|
sysOutStream.reset();
|
|
sysOutStream.reset();
|
|
@@ -857,7 +861,7 @@ public class TestYarnCLI {
|
|
pw.println("\t N/A");
|
|
pw.println("\t N/A");
|
|
pw.close();
|
|
pw.close();
|
|
appsReportStr = baos.toString("UTF-8");
|
|
appsReportStr = baos.toString("UTF-8");
|
|
- Assert.assertEquals(appsReportStr, sysOutStream.toString());
|
|
|
|
|
|
+ assertEquals(appsReportStr, sysOutStream.toString());
|
|
verify(sysOut, times(9)).write(any(byte[].class), anyInt(), anyInt());
|
|
verify(sysOut, times(9)).write(any(byte[].class), anyInt(), anyInt());
|
|
|
|
|
|
sysOutStream.reset();
|
|
sysOutStream.reset();
|
|
@@ -888,7 +892,7 @@ public class TestYarnCLI {
|
|
pw.println("\t N/A");
|
|
pw.println("\t N/A");
|
|
pw.close();
|
|
pw.close();
|
|
appsReportStr = baos.toString("UTF-8");
|
|
appsReportStr = baos.toString("UTF-8");
|
|
- Assert.assertEquals(appsReportStr, sysOutStream.toString());
|
|
|
|
|
|
+ assertEquals(appsReportStr, sysOutStream.toString());
|
|
verify(sysOut, times(10)).write(any(byte[].class), anyInt(), anyInt());
|
|
verify(sysOut, times(10)).write(any(byte[].class), anyInt(), anyInt());
|
|
}
|
|
}
|
|
|
|
|
|
@@ -938,14 +942,15 @@ public class TestYarnCLI {
|
|
return appReports;
|
|
return appReports;
|
|
}
|
|
}
|
|
|
|
|
|
- @Test (timeout = 10000)
|
|
|
|
|
|
+ @Test
|
|
|
|
+ @Timeout(value = 10)
|
|
public void testAppsHelpCommand() throws Exception {
|
|
public void testAppsHelpCommand() throws Exception {
|
|
ApplicationCLI cli = createAndGetAppCLI();
|
|
ApplicationCLI cli = createAndGetAppCLI();
|
|
ApplicationCLI spyCli = spy(cli);
|
|
ApplicationCLI spyCli = spy(cli);
|
|
int result = spyCli.run(new String[] { "application", "-help" });
|
|
int result = spyCli.run(new String[] { "application", "-help" });
|
|
- Assert.assertTrue(result == 0);
|
|
|
|
|
|
+ assertTrue(result == 0);
|
|
verify(spyCli).printUsage(any(String.class), any(Options.class));
|
|
verify(spyCli).printUsage(any(String.class), any(Options.class));
|
|
- Assert.assertEquals(createApplicationCLIHelpMessage(),
|
|
|
|
|
|
+ assertEquals(createApplicationCLIHelpMessage(),
|
|
sysOutStream.toString());
|
|
sysOutStream.toString());
|
|
|
|
|
|
sysOutStream.reset();
|
|
sysOutStream.reset();
|
|
@@ -953,18 +958,19 @@ public class TestYarnCLI {
|
|
result = cli.run(
|
|
result = cli.run(
|
|
new String[] { "application", "-status", nodeId.toString(), "args" });
|
|
new String[] { "application", "-status", nodeId.toString(), "args" });
|
|
verify(spyCli).printUsage(any(String.class), any(Options.class));
|
|
verify(spyCli).printUsage(any(String.class), any(Options.class));
|
|
- Assert.assertEquals(createApplicationCLIHelpMessage(),
|
|
|
|
|
|
+ assertEquals(createApplicationCLIHelpMessage(),
|
|
sysOutStream.toString());
|
|
sysOutStream.toString());
|
|
}
|
|
}
|
|
|
|
|
|
- @Test (timeout = 10000)
|
|
|
|
|
|
+ @Test
|
|
|
|
+ @Timeout(value = 10)
|
|
public void testAppAttemptsHelpCommand() throws Exception {
|
|
public void testAppAttemptsHelpCommand() throws Exception {
|
|
ApplicationCLI cli = createAndGetAppCLI();
|
|
ApplicationCLI cli = createAndGetAppCLI();
|
|
ApplicationCLI spyCli = spy(cli);
|
|
ApplicationCLI spyCli = spy(cli);
|
|
int result = spyCli.run(new String[] { "applicationattempt", "-help" });
|
|
int result = spyCli.run(new String[] { "applicationattempt", "-help" });
|
|
- Assert.assertTrue(result == 0);
|
|
|
|
|
|
+ assertTrue(result == 0);
|
|
verify(spyCli).printUsage(any(String.class), any(Options.class));
|
|
verify(spyCli).printUsage(any(String.class), any(Options.class));
|
|
- Assert.assertEquals(createApplicationAttemptCLIHelpMessage(),
|
|
|
|
|
|
+ assertEquals(createApplicationAttemptCLIHelpMessage(),
|
|
sysOutStream.toString());
|
|
sysOutStream.toString());
|
|
|
|
|
|
sysOutStream.reset();
|
|
sysOutStream.reset();
|
|
@@ -973,7 +979,7 @@ public class TestYarnCLI {
|
|
new String[] {"applicationattempt", "-list", applicationId.toString(),
|
|
new String[] {"applicationattempt", "-list", applicationId.toString(),
|
|
"args" });
|
|
"args" });
|
|
verify(spyCli).printUsage(any(String.class), any(Options.class));
|
|
verify(spyCli).printUsage(any(String.class), any(Options.class));
|
|
- Assert.assertEquals(createApplicationAttemptCLIHelpMessage(),
|
|
|
|
|
|
+ assertEquals(createApplicationAttemptCLIHelpMessage(),
|
|
sysOutStream.toString());
|
|
sysOutStream.toString());
|
|
|
|
|
|
sysOutStream.reset();
|
|
sysOutStream.reset();
|
|
@@ -983,18 +989,19 @@ public class TestYarnCLI {
|
|
new String[] { "applicationattempt", "-status", appAttemptId.toString(),
|
|
new String[] { "applicationattempt", "-status", appAttemptId.toString(),
|
|
"args" });
|
|
"args" });
|
|
verify(spyCli).printUsage(any(String.class), any(Options.class));
|
|
verify(spyCli).printUsage(any(String.class), any(Options.class));
|
|
- Assert.assertEquals(createApplicationAttemptCLIHelpMessage(),
|
|
|
|
|
|
+ assertEquals(createApplicationAttemptCLIHelpMessage(),
|
|
sysOutStream.toString());
|
|
sysOutStream.toString());
|
|
}
|
|
}
|
|
|
|
|
|
- @Test (timeout = 10000)
|
|
|
|
|
|
+ @Test
|
|
|
|
+ @Timeout(value = 10)
|
|
public void testContainersHelpCommand() throws Exception {
|
|
public void testContainersHelpCommand() throws Exception {
|
|
ApplicationCLI cli = createAndGetAppCLI();
|
|
ApplicationCLI cli = createAndGetAppCLI();
|
|
ApplicationCLI spyCli = spy(cli);
|
|
ApplicationCLI spyCli = spy(cli);
|
|
int result = spyCli.run(new String[] { "container", "-help" });
|
|
int result = spyCli.run(new String[] { "container", "-help" });
|
|
- Assert.assertTrue(result == 0);
|
|
|
|
|
|
+ assertTrue(result == 0);
|
|
verify(spyCli).printUsage(any(String.class), any(Options.class));
|
|
verify(spyCli).printUsage(any(String.class), any(Options.class));
|
|
- Assert.assertEquals(createContainerCLIHelpMessage(),
|
|
|
|
|
|
+ assertEquals(createContainerCLIHelpMessage(),
|
|
normalize(sysOutStream.toString()));
|
|
normalize(sysOutStream.toString()));
|
|
|
|
|
|
sysOutStream.reset();
|
|
sysOutStream.reset();
|
|
@@ -1004,7 +1011,7 @@ public class TestYarnCLI {
|
|
result = cli.run(
|
|
result = cli.run(
|
|
new String[] {"container", "-list", appAttemptId.toString(), "args" });
|
|
new String[] {"container", "-list", appAttemptId.toString(), "args" });
|
|
verify(spyCli).printUsage(any(String.class), any(Options.class));
|
|
verify(spyCli).printUsage(any(String.class), any(Options.class));
|
|
- Assert.assertEquals(createContainerCLIHelpMessage(),
|
|
|
|
|
|
+ assertEquals(createContainerCLIHelpMessage(),
|
|
normalize(sysOutStream.toString()));
|
|
normalize(sysOutStream.toString()));
|
|
|
|
|
|
sysOutStream.reset();
|
|
sysOutStream.reset();
|
|
@@ -1012,15 +1019,16 @@ public class TestYarnCLI {
|
|
result = cli.run(
|
|
result = cli.run(
|
|
new String[] { "container", "-status", containerId.toString(), "args" });
|
|
new String[] { "container", "-status", containerId.toString(), "args" });
|
|
verify(spyCli).printUsage(any(String.class), any(Options.class));
|
|
verify(spyCli).printUsage(any(String.class), any(Options.class));
|
|
- Assert.assertEquals(createContainerCLIHelpMessage(),
|
|
|
|
|
|
+ assertEquals(createContainerCLIHelpMessage(),
|
|
normalize(sysOutStream.toString()));
|
|
normalize(sysOutStream.toString()));
|
|
}
|
|
}
|
|
|
|
|
|
- @Test (timeout = 5000)
|
|
|
|
|
|
+ @Test
|
|
|
|
+ @Timeout(value = 5)
|
|
public void testNodesHelpCommand() throws Exception {
|
|
public void testNodesHelpCommand() throws Exception {
|
|
NodeCLI nodeCLI = createAndGetNodeCLI();
|
|
NodeCLI nodeCLI = createAndGetNodeCLI();
|
|
nodeCLI.run(new String[] {});
|
|
nodeCLI.run(new String[] {});
|
|
- Assert.assertEquals(createNodeCLIHelpMessage(),
|
|
|
|
|
|
+ assertEquals(createNodeCLIHelpMessage(),
|
|
sysOutStream.toString());
|
|
sysOutStream.toString());
|
|
}
|
|
}
|
|
|
|
|
|
@@ -1063,12 +1071,12 @@ public class TestYarnCLI {
|
|
cli.run(new String[] { "application","-kill", applicationId.toString() });
|
|
cli.run(new String[] { "application","-kill", applicationId.toString() });
|
|
verify(sysOut).println("Application with id '" + applicationId +
|
|
verify(sysOut).println("Application with id '" + applicationId +
|
|
"' doesn't exist in RM.");
|
|
"' doesn't exist in RM.");
|
|
- Assert.assertNotSame("should return non-zero exit code.", 0, exitCode);
|
|
|
|
|
|
+ assertNotSame(0, exitCode, "should return non-zero exit code.");
|
|
} catch (ApplicationNotFoundException appEx) {
|
|
} catch (ApplicationNotFoundException appEx) {
|
|
- Assert.fail("application -kill should not throw" +
|
|
|
|
|
|
+ fail("application -kill should not throw" +
|
|
"ApplicationNotFoundException. " + appEx);
|
|
"ApplicationNotFoundException. " + appEx);
|
|
} catch (Exception e) {
|
|
} catch (Exception e) {
|
|
- Assert.fail("Unexpected exception: " + e);
|
|
|
|
|
|
+ fail("Unexpected exception: " + e);
|
|
}
|
|
}
|
|
}
|
|
}
|
|
|
|
|
|
@@ -1139,7 +1147,7 @@ public class TestYarnCLI {
|
|
.getApplicationReport(applicationId4);
|
|
.getApplicationReport(applicationId4);
|
|
result = cli.run(new String[]{"application", "-kill",
|
|
result = cli.run(new String[]{"application", "-kill",
|
|
applicationId3.toString() + " " + applicationId4.toString()});
|
|
applicationId3.toString() + " " + applicationId4.toString()});
|
|
- Assert.assertNotEquals(0, result);
|
|
|
|
|
|
+ assertNotEquals(0, result);
|
|
verify(sysOut).println(
|
|
verify(sysOut).println(
|
|
"Application with id 'application_1234_0007' doesn't exist in RM.");
|
|
"Application with id 'application_1234_0007' doesn't exist in RM.");
|
|
verify(sysOut).println(
|
|
verify(sysOut).println(
|
|
@@ -1158,14 +1166,14 @@ public class TestYarnCLI {
|
|
newApplicationReport5);
|
|
newApplicationReport5);
|
|
result = cli.run(new String[]{"application", "-kill",
|
|
result = cli.run(new String[]{"application", "-kill",
|
|
applicationId3.toString() + " " + applicationId1.toString()});
|
|
applicationId3.toString() + " " + applicationId1.toString()});
|
|
- Assert.assertEquals(0, result);
|
|
|
|
|
|
+ assertEquals(0, result);
|
|
|
|
|
|
// Test Scenario 5: kill operation with some other command.
|
|
// Test Scenario 5: kill operation with some other command.
|
|
sysOutStream.reset();
|
|
sysOutStream.reset();
|
|
result = cli.run(new String[]{"application", "--appStates", "RUNNING",
|
|
result = cli.run(new String[]{"application", "--appStates", "RUNNING",
|
|
"-kill", applicationId3.toString() + " " + applicationId1.toString()});
|
|
"-kill", applicationId3.toString() + " " + applicationId1.toString()});
|
|
- Assert.assertEquals(-1, result);
|
|
|
|
- Assert.assertEquals(createApplicationCLIHelpMessage(),
|
|
|
|
|
|
+ assertEquals(-1, result);
|
|
|
|
+ assertEquals(createApplicationCLIHelpMessage(),
|
|
sysOutStream.toString());
|
|
sysOutStream.toString());
|
|
}
|
|
}
|
|
|
|
|
|
@@ -1241,10 +1249,10 @@ public class TestYarnCLI {
|
|
try {
|
|
try {
|
|
result = cli.run(new String[] { "application", "-movetoqueue",
|
|
result = cli.run(new String[] { "application", "-movetoqueue",
|
|
applicationId.toString(), "-queue", "targetqueue"});
|
|
applicationId.toString(), "-queue", "targetqueue"});
|
|
- Assert.fail();
|
|
|
|
|
|
+ fail();
|
|
} catch (Exception ex) {
|
|
} catch (Exception ex) {
|
|
- Assert.assertTrue(ex instanceof ApplicationNotFoundException);
|
|
|
|
- Assert.assertEquals("Application with id '" + applicationId +
|
|
|
|
|
|
+ assertTrue(ex instanceof ApplicationNotFoundException);
|
|
|
|
+ assertEquals("Application with id '" + applicationId +
|
|
"' doesn't exist in RM.", ex.getMessage());
|
|
"' doesn't exist in RM.", ex.getMessage());
|
|
}
|
|
}
|
|
}
|
|
}
|
|
@@ -1293,10 +1301,10 @@ public class TestYarnCLI {
|
|
try {
|
|
try {
|
|
result = cli.run(new String[]{"application", "-appId",
|
|
result = cli.run(new String[]{"application", "-appId",
|
|
applicationId.toString(), "-changeQueue", "targetqueue"});
|
|
applicationId.toString(), "-changeQueue", "targetqueue"});
|
|
- Assert.fail();
|
|
|
|
|
|
+ fail();
|
|
} catch (Exception ex) {
|
|
} catch (Exception ex) {
|
|
- Assert.assertTrue(ex instanceof ApplicationNotFoundException);
|
|
|
|
- Assert.assertEquals(
|
|
|
|
|
|
+ assertTrue(ex instanceof ApplicationNotFoundException);
|
|
|
|
+ assertEquals(
|
|
"Application with id '" + applicationId + "' doesn't exist in RM.",
|
|
"Application with id '" + applicationId + "' doesn't exist in RM.",
|
|
ex.getMessage());
|
|
ex.getMessage());
|
|
}
|
|
}
|
|
@@ -1331,7 +1339,7 @@ public class TestYarnCLI {
|
|
pw.println(" 0");
|
|
pw.println(" 0");
|
|
pw.close();
|
|
pw.close();
|
|
String nodesReportStr = baos.toString("UTF-8");
|
|
String nodesReportStr = baos.toString("UTF-8");
|
|
- Assert.assertEquals(nodesReportStr, sysOutStream.toString());
|
|
|
|
|
|
+ assertEquals(nodesReportStr, sysOutStream.toString());
|
|
verify(sysOut, times(1)).write(any(byte[].class), anyInt(), anyInt());
|
|
verify(sysOut, times(1)).write(any(byte[].class), anyInt(), anyInt());
|
|
|
|
|
|
sysOutStream.reset();
|
|
sysOutStream.reset();
|
|
@@ -1354,13 +1362,13 @@ public class TestYarnCLI {
|
|
pw.println(" 0");
|
|
pw.println(" 0");
|
|
pw.close();
|
|
pw.close();
|
|
nodesReportStr = baos.toString("UTF-8");
|
|
nodesReportStr = baos.toString("UTF-8");
|
|
- Assert.assertEquals(nodesReportStr, sysOutStream.toString());
|
|
|
|
|
|
+ assertEquals(nodesReportStr, sysOutStream.toString());
|
|
verify(sysOut, times(2)).write(any(byte[].class), anyInt(), anyInt());
|
|
verify(sysOut, times(2)).write(any(byte[].class), anyInt(), anyInt());
|
|
|
|
|
|
sysOutStream.reset();
|
|
sysOutStream.reset();
|
|
result = cli.run(new String[] {"-list"});
|
|
result = cli.run(new String[] {"-list"});
|
|
assertEquals(0, result);
|
|
assertEquals(0, result);
|
|
- Assert.assertEquals(nodesReportStr, sysOutStream.toString());
|
|
|
|
|
|
+ assertEquals(nodesReportStr, sysOutStream.toString());
|
|
verify(sysOut, times(3)).write(any(byte[].class), anyInt(), anyInt());
|
|
verify(sysOut, times(3)).write(any(byte[].class), anyInt(), anyInt());
|
|
|
|
|
|
sysOutStream.reset();
|
|
sysOutStream.reset();
|
|
@@ -1389,7 +1397,7 @@ public class TestYarnCLI {
|
|
pw.println("\tNode-Labels : ");
|
|
pw.println("\tNode-Labels : ");
|
|
pw.close();
|
|
pw.close();
|
|
nodesReportStr = baos.toString("UTF-8");
|
|
nodesReportStr = baos.toString("UTF-8");
|
|
- Assert.assertEquals(nodesReportStr, sysOutStream.toString());
|
|
|
|
|
|
+ assertEquals(nodesReportStr, sysOutStream.toString());
|
|
verify(sysOut, times(4)).write(any(byte[].class), anyInt(), anyInt());
|
|
verify(sysOut, times(4)).write(any(byte[].class), anyInt(), anyInt());
|
|
|
|
|
|
sysOutStream.reset();
|
|
sysOutStream.reset();
|
|
@@ -1410,7 +1418,7 @@ public class TestYarnCLI {
|
|
pw.println(" 0");
|
|
pw.println(" 0");
|
|
pw.close();
|
|
pw.close();
|
|
nodesReportStr = baos.toString("UTF-8");
|
|
nodesReportStr = baos.toString("UTF-8");
|
|
- Assert.assertEquals(nodesReportStr, sysOutStream.toString());
|
|
|
|
|
|
+ assertEquals(nodesReportStr, sysOutStream.toString());
|
|
verify(sysOut, times(5)).write(any(byte[].class), anyInt(), anyInt());
|
|
verify(sysOut, times(5)).write(any(byte[].class), anyInt(), anyInt());
|
|
|
|
|
|
sysOutStream.reset();
|
|
sysOutStream.reset();
|
|
@@ -1431,7 +1439,7 @@ public class TestYarnCLI {
|
|
pw.println(" 0");
|
|
pw.println(" 0");
|
|
pw.close();
|
|
pw.close();
|
|
nodesReportStr = baos.toString("UTF-8");
|
|
nodesReportStr = baos.toString("UTF-8");
|
|
- Assert.assertEquals(nodesReportStr, sysOutStream.toString());
|
|
|
|
|
|
+ assertEquals(nodesReportStr, sysOutStream.toString());
|
|
verify(sysOut, times(6)).write(any(byte[].class), anyInt(), anyInt());
|
|
verify(sysOut, times(6)).write(any(byte[].class), anyInt(), anyInt());
|
|
|
|
|
|
sysOutStream.reset();
|
|
sysOutStream.reset();
|
|
@@ -1452,7 +1460,7 @@ public class TestYarnCLI {
|
|
pw.println(" 0");
|
|
pw.println(" 0");
|
|
pw.close();
|
|
pw.close();
|
|
nodesReportStr = baos.toString("UTF-8");
|
|
nodesReportStr = baos.toString("UTF-8");
|
|
- Assert.assertEquals(nodesReportStr, sysOutStream.toString());
|
|
|
|
|
|
+ assertEquals(nodesReportStr, sysOutStream.toString());
|
|
verify(sysOut, times(7)).write(any(byte[].class), anyInt(), anyInt());
|
|
verify(sysOut, times(7)).write(any(byte[].class), anyInt(), anyInt());
|
|
|
|
|
|
sysOutStream.reset();
|
|
sysOutStream.reset();
|
|
@@ -1473,7 +1481,7 @@ public class TestYarnCLI {
|
|
pw.println(" 0");
|
|
pw.println(" 0");
|
|
pw.close();
|
|
pw.close();
|
|
nodesReportStr = baos.toString("UTF-8");
|
|
nodesReportStr = baos.toString("UTF-8");
|
|
- Assert.assertEquals(nodesReportStr, sysOutStream.toString());
|
|
|
|
|
|
+ assertEquals(nodesReportStr, sysOutStream.toString());
|
|
verify(sysOut, times(8)).write(any(byte[].class), anyInt(), anyInt());
|
|
verify(sysOut, times(8)).write(any(byte[].class), anyInt(), anyInt());
|
|
|
|
|
|
sysOutStream.reset();
|
|
sysOutStream.reset();
|
|
@@ -1506,7 +1514,7 @@ public class TestYarnCLI {
|
|
pw.println(" 0");
|
|
pw.println(" 0");
|
|
pw.close();
|
|
pw.close();
|
|
nodesReportStr = baos.toString("UTF-8");
|
|
nodesReportStr = baos.toString("UTF-8");
|
|
- Assert.assertEquals(nodesReportStr, sysOutStream.toString());
|
|
|
|
|
|
+ assertEquals(nodesReportStr, sysOutStream.toString());
|
|
verify(sysOut, times(9)).write(any(byte[].class), anyInt(), anyInt());
|
|
verify(sysOut, times(9)).write(any(byte[].class), anyInt(), anyInt());
|
|
|
|
|
|
sysOutStream.reset();
|
|
sysOutStream.reset();
|
|
@@ -1541,7 +1549,7 @@ public class TestYarnCLI {
|
|
pw.println(" 0");
|
|
pw.println(" 0");
|
|
pw.close();
|
|
pw.close();
|
|
nodesReportStr = baos.toString("UTF-8");
|
|
nodesReportStr = baos.toString("UTF-8");
|
|
- Assert.assertEquals(nodesReportStr, sysOutStream.toString());
|
|
|
|
|
|
+ assertEquals(nodesReportStr, sysOutStream.toString());
|
|
verify(sysOut, times(10)).write(any(byte[].class), anyInt(), anyInt());
|
|
verify(sysOut, times(10)).write(any(byte[].class), anyInt(), anyInt());
|
|
|
|
|
|
sysOutStream.reset();
|
|
sysOutStream.reset();
|
|
@@ -1695,26 +1703,26 @@ public class TestYarnCLI {
|
|
ApplicationCLI cli = createAndGetAppCLI();
|
|
ApplicationCLI cli = createAndGetAppCLI();
|
|
int result = cli.run(new String[] { "application", "-status" });
|
|
int result = cli.run(new String[] { "application", "-status" });
|
|
assertThat(result).isEqualTo(-1);
|
|
assertThat(result).isEqualTo(-1);
|
|
- Assert.assertEquals(String.format("Missing argument for options%n%1s",
|
|
|
|
|
|
+ assertEquals(String.format("Missing argument for options%n%1s",
|
|
createApplicationCLIHelpMessage()), sysOutStream.toString());
|
|
createApplicationCLIHelpMessage()), sysOutStream.toString());
|
|
|
|
|
|
sysOutStream.reset();
|
|
sysOutStream.reset();
|
|
result = cli.run(new String[] { "applicationattempt", "-status" });
|
|
result = cli.run(new String[] { "applicationattempt", "-status" });
|
|
assertThat(result).isEqualTo(-1);
|
|
assertThat(result).isEqualTo(-1);
|
|
- Assert.assertEquals(String.format("Missing argument for options%n%1s",
|
|
|
|
|
|
+ assertEquals(String.format("Missing argument for options%n%1s",
|
|
createApplicationAttemptCLIHelpMessage()), sysOutStream.toString());
|
|
createApplicationAttemptCLIHelpMessage()), sysOutStream.toString());
|
|
|
|
|
|
sysOutStream.reset();
|
|
sysOutStream.reset();
|
|
result = cli.run(new String[] { "container", "-status" });
|
|
result = cli.run(new String[] { "container", "-status" });
|
|
assertThat(result).isEqualTo(-1);
|
|
assertThat(result).isEqualTo(-1);
|
|
- Assert.assertEquals(String.format("Missing argument for options %1s",
|
|
|
|
|
|
+ assertEquals(String.format("Missing argument for options %1s",
|
|
createContainerCLIHelpMessage()), normalize(sysOutStream.toString()));
|
|
createContainerCLIHelpMessage()), normalize(sysOutStream.toString()));
|
|
|
|
|
|
sysOutStream.reset();
|
|
sysOutStream.reset();
|
|
NodeCLI nodeCLI = createAndGetNodeCLI();
|
|
NodeCLI nodeCLI = createAndGetNodeCLI();
|
|
result = nodeCLI.run(new String[] { "-status" });
|
|
result = nodeCLI.run(new String[] { "-status" });
|
|
assertThat(result).isEqualTo(-1);
|
|
assertThat(result).isEqualTo(-1);
|
|
- Assert.assertEquals(String.format("Missing argument for options%n%1s",
|
|
|
|
|
|
+ assertEquals(String.format("Missing argument for options%n%1s",
|
|
createNodeCLIHelpMessage()), sysOutStream.toString());
|
|
createNodeCLIHelpMessage()), sysOutStream.toString());
|
|
}
|
|
}
|
|
|
|
|
|
@@ -1751,7 +1759,7 @@ public class TestYarnCLI {
|
|
pw.println("\tIntra-queue Preemption : " + "enabled");
|
|
pw.println("\tIntra-queue Preemption : " + "enabled");
|
|
pw.close();
|
|
pw.close();
|
|
String queueInfoStr = baos.toString("UTF-8");
|
|
String queueInfoStr = baos.toString("UTF-8");
|
|
- Assert.assertEquals(queueInfoStr, sysOutStream.toString());
|
|
|
|
|
|
+ assertEquals(queueInfoStr, sysOutStream.toString());
|
|
}
|
|
}
|
|
|
|
|
|
@Test
|
|
@Test
|
|
@@ -1775,7 +1783,7 @@ public class TestYarnCLI {
|
|
queueInfos.add(queueInfo3);
|
|
queueInfos.add(queueInfo3);
|
|
when(client.getAllQueues()).thenReturn(queueInfos);
|
|
when(client.getAllQueues()).thenReturn(queueInfos);
|
|
int result = cli.run(new String[] {"-list", "all"});
|
|
int result = cli.run(new String[] {"-list", "all"});
|
|
- Assert.assertEquals(0, result);
|
|
|
|
|
|
+ assertEquals(0, result);
|
|
verify(client).getAllQueues();
|
|
verify(client).getAllQueues();
|
|
ByteArrayOutputStream baos = new ByteArrayOutputStream();
|
|
ByteArrayOutputStream baos = new ByteArrayOutputStream();
|
|
PrintWriter writer = new PrintWriter(baos);
|
|
PrintWriter writer = new PrintWriter(baos);
|
|
@@ -1796,7 +1804,7 @@ public class TestYarnCLI {
|
|
writer.print(formattingCLIUtils.render());
|
|
writer.print(formattingCLIUtils.render());
|
|
writer.close();
|
|
writer.close();
|
|
String queueInfoStr = baos.toString("UTF-8");
|
|
String queueInfoStr = baos.toString("UTF-8");
|
|
- Assert.assertEquals(queueInfoStr, sysOutStream.toString());
|
|
|
|
|
|
+ assertEquals(queueInfoStr, sysOutStream.toString());
|
|
}
|
|
}
|
|
|
|
|
|
@Test
|
|
@Test
|
|
@@ -1837,10 +1845,10 @@ public class TestYarnCLI {
|
|
int result = cli.run(new String[] { "-status", "a" });
|
|
int result = cli.run(new String[] { "-status", "a" });
|
|
assertEquals(0, result);
|
|
assertEquals(0, result);
|
|
String queueStatusOut = sysOutStream.toString();
|
|
String queueStatusOut = sysOutStream.toString();
|
|
- Assert.assertTrue(queueStatusOut
|
|
|
|
|
|
+ assertTrue(queueStatusOut
|
|
.contains("\tPreemption : enabled"));
|
|
.contains("\tPreemption : enabled"));
|
|
// In-queue preemption is disabled at the "root.a" queue level
|
|
// In-queue preemption is disabled at the "root.a" queue level
|
|
- Assert.assertTrue(queueStatusOut
|
|
|
|
|
|
+ assertTrue(queueStatusOut
|
|
.contains("Intra-queue Preemption : disabled"));
|
|
.contains("Intra-queue Preemption : disabled"));
|
|
cli = createAndGetQueueCLI(yarnClient);
|
|
cli = createAndGetQueueCLI(yarnClient);
|
|
sysOutStream.reset();
|
|
sysOutStream.reset();
|
|
@@ -1848,10 +1856,10 @@ public class TestYarnCLI {
|
|
result = cli.run(new String[] { "-status", "a1" });
|
|
result = cli.run(new String[] { "-status", "a1" });
|
|
assertEquals(0, result);
|
|
assertEquals(0, result);
|
|
queueStatusOut = sysOutStream.toString();
|
|
queueStatusOut = sysOutStream.toString();
|
|
- Assert.assertTrue(queueStatusOut
|
|
|
|
|
|
+ assertTrue(queueStatusOut
|
|
.contains("\tPreemption : enabled"));
|
|
.contains("\tPreemption : enabled"));
|
|
// In-queue preemption is enabled at the "root.a.a1" queue level
|
|
// In-queue preemption is enabled at the "root.a.a1" queue level
|
|
- Assert.assertTrue(queueStatusOut
|
|
|
|
|
|
+ assertTrue(queueStatusOut
|
|
.contains("Intra-queue Preemption : enabled"));
|
|
.contains("Intra-queue Preemption : enabled"));
|
|
} finally {
|
|
} finally {
|
|
// clean-up
|
|
// clean-up
|
|
@@ -1892,9 +1900,9 @@ public class TestYarnCLI {
|
|
int result = cli.run(new String[] { "-status", "a1" });
|
|
int result = cli.run(new String[] { "-status", "a1" });
|
|
assertEquals(0, result);
|
|
assertEquals(0, result);
|
|
String queueStatusOut = sysOutStream.toString();
|
|
String queueStatusOut = sysOutStream.toString();
|
|
- Assert.assertTrue(queueStatusOut
|
|
|
|
|
|
+ assertTrue(queueStatusOut
|
|
.contains("\tPreemption : enabled"));
|
|
.contains("\tPreemption : enabled"));
|
|
- Assert.assertTrue(queueStatusOut
|
|
|
|
|
|
+ assertTrue(queueStatusOut
|
|
.contains("Intra-queue Preemption : enabled"));
|
|
.contains("Intra-queue Preemption : enabled"));
|
|
} finally {
|
|
} finally {
|
|
// clean-up
|
|
// clean-up
|
|
@@ -1933,9 +1941,9 @@ public class TestYarnCLI {
|
|
int result = cli.run(new String[] { "-status", "a1" });
|
|
int result = cli.run(new String[] { "-status", "a1" });
|
|
assertEquals(0, result);
|
|
assertEquals(0, result);
|
|
String queueStatusOut = sysOutStream.toString();
|
|
String queueStatusOut = sysOutStream.toString();
|
|
- Assert.assertTrue(queueStatusOut
|
|
|
|
|
|
+ assertTrue(queueStatusOut
|
|
.contains("\tPreemption : disabled"));
|
|
.contains("\tPreemption : disabled"));
|
|
- Assert.assertTrue(queueStatusOut
|
|
|
|
|
|
+ assertTrue(queueStatusOut
|
|
.contains("Intra-queue Preemption : disabled"));
|
|
.contains("Intra-queue Preemption : disabled"));
|
|
}
|
|
}
|
|
}
|
|
}
|
|
@@ -1970,7 +1978,7 @@ public class TestYarnCLI {
|
|
pw.println("\tIntra-queue Preemption : " + "disabled");
|
|
pw.println("\tIntra-queue Preemption : " + "disabled");
|
|
pw.close();
|
|
pw.close();
|
|
String queueInfoStr = baos.toString("UTF-8");
|
|
String queueInfoStr = baos.toString("UTF-8");
|
|
- Assert.assertEquals(queueInfoStr, sysOutStream.toString());
|
|
|
|
|
|
+ assertEquals(queueInfoStr, sysOutStream.toString());
|
|
}
|
|
}
|
|
|
|
|
|
@Test
|
|
@Test
|
|
@@ -2014,7 +2022,7 @@ public class TestYarnCLI {
|
|
pw.println("\tQueue Preemption : enabled");
|
|
pw.println("\tQueue Preemption : enabled");
|
|
pw.close();
|
|
pw.close();
|
|
String queueInfoStr = baos.toString("UTF-8");
|
|
String queueInfoStr = baos.toString("UTF-8");
|
|
- Assert.assertEquals(queueInfoStr, sysOutStream.toString());
|
|
|
|
|
|
+ assertEquals(queueInfoStr, sysOutStream.toString());
|
|
}
|
|
}
|
|
|
|
|
|
@Test
|
|
@Test
|
|
@@ -2062,7 +2070,7 @@ public class TestYarnCLI {
|
|
pw.println("\tQueue Preemption : " + "enabled");
|
|
pw.println("\tQueue Preemption : " + "enabled");
|
|
pw.close();
|
|
pw.close();
|
|
String queueInfoStr = baos.toString("UTF-8");
|
|
String queueInfoStr = baos.toString("UTF-8");
|
|
- Assert.assertEquals(queueInfoStr, sysOutStream.toString());
|
|
|
|
|
|
+ assertEquals(queueInfoStr, sysOutStream.toString());
|
|
}
|
|
}
|
|
|
|
|
|
@Test
|
|
@Test
|
|
@@ -2078,7 +2086,7 @@ public class TestYarnCLI {
|
|
+ ", please check.");
|
|
+ ", please check.");
|
|
pw.close();
|
|
pw.close();
|
|
String queueInfoStr = baos.toString("UTF-8");
|
|
String queueInfoStr = baos.toString("UTF-8");
|
|
- Assert.assertEquals(queueInfoStr, sysOutStream.toString());
|
|
|
|
|
|
+ assertEquals(queueInfoStr, sysOutStream.toString());
|
|
}
|
|
}
|
|
|
|
|
|
@Test
|
|
@Test
|
|
@@ -2096,7 +2104,7 @@ public class TestYarnCLI {
|
|
verify(sysOut).println(
|
|
verify(sysOut).println(
|
|
"Application for AppAttempt with id '" + attemptId1
|
|
"Application for AppAttempt with id '" + attemptId1
|
|
+ "' doesn't exist in RM or Timeline Server.");
|
|
+ "' doesn't exist in RM or Timeline Server.");
|
|
- Assert.assertNotSame("should return non-zero exit code.", 0, exitCode);
|
|
|
|
|
|
+ assertNotSame(0, exitCode, "should return non-zero exit code.");
|
|
|
|
|
|
ApplicationAttemptId attemptId2 = ApplicationAttemptId.newInstance(
|
|
ApplicationAttemptId attemptId2 = ApplicationAttemptId.newInstance(
|
|
applicationId, 2);
|
|
applicationId, 2);
|
|
@@ -2110,7 +2118,7 @@ public class TestYarnCLI {
|
|
verify(sysOut).println(
|
|
verify(sysOut).println(
|
|
"Application Attempt with id '" + attemptId2
|
|
"Application Attempt with id '" + attemptId2
|
|
+ "' doesn't exist in RM or Timeline Server.");
|
|
+ "' doesn't exist in RM or Timeline Server.");
|
|
- Assert.assertNotSame("should return non-zero exit code.", 0, exitCode);
|
|
|
|
|
|
+ assertNotSame(0, exitCode, "should return non-zero exit code.");
|
|
}
|
|
}
|
|
|
|
|
|
@Test
|
|
@Test
|
|
@@ -2130,7 +2138,7 @@ public class TestYarnCLI {
|
|
verify(sysOut).println(
|
|
verify(sysOut).println(
|
|
"Application for Container with id '" + containerId1
|
|
"Application for Container with id '" + containerId1
|
|
+ "' doesn't exist in RM or Timeline Server.");
|
|
+ "' doesn't exist in RM or Timeline Server.");
|
|
- Assert.assertNotSame("should return non-zero exit code.", 0, exitCode);
|
|
|
|
|
|
+ assertNotSame(0, exitCode, "should return non-zero exit code.");
|
|
ContainerId containerId2 = ContainerId.newContainerId(attemptId, cntId++);
|
|
ContainerId containerId2 = ContainerId.newContainerId(attemptId, cntId++);
|
|
when(client.getContainerReport(containerId2)).thenThrow(
|
|
when(client.getContainerReport(containerId2)).thenThrow(
|
|
new ApplicationAttemptNotFoundException(
|
|
new ApplicationAttemptNotFoundException(
|
|
@@ -2142,7 +2150,7 @@ public class TestYarnCLI {
|
|
verify(sysOut).println(
|
|
verify(sysOut).println(
|
|
"Application Attempt for Container with id '" + containerId2
|
|
"Application Attempt for Container with id '" + containerId2
|
|
+ "' doesn't exist in RM or Timeline Server.");
|
|
+ "' doesn't exist in RM or Timeline Server.");
|
|
- Assert.assertNotSame("should return non-zero exit code.", 0, exitCode);
|
|
|
|
|
|
+ assertNotSame(0, exitCode, "should return non-zero exit code.");
|
|
|
|
|
|
ContainerId containerId3 = ContainerId.newContainerId(attemptId, cntId++);
|
|
ContainerId containerId3 = ContainerId.newContainerId(attemptId, cntId++);
|
|
when(client.getContainerReport(containerId3)).thenThrow(
|
|
when(client.getContainerReport(containerId3)).thenThrow(
|
|
@@ -2153,10 +2161,11 @@ public class TestYarnCLI {
|
|
verify(sysOut).println(
|
|
verify(sysOut).println(
|
|
"Container with id '" + containerId3
|
|
"Container with id '" + containerId3
|
|
+ "' doesn't exist in RM or Timeline Server.");
|
|
+ "' doesn't exist in RM or Timeline Server.");
|
|
- Assert.assertNotSame("should return non-zero exit code.", 0, exitCode);
|
|
|
|
|
|
+ assertNotSame(0, exitCode, "should return non-zero exit code.");
|
|
}
|
|
}
|
|
|
|
|
|
- @Test(timeout = 60000)
|
|
|
|
|
|
+ @Test
|
|
|
|
+ @Timeout(value = 60)
|
|
public void testUpdateApplicationPriority() throws Exception {
|
|
public void testUpdateApplicationPriority() throws Exception {
|
|
ApplicationCLI cli = createAndGetAppCLI();
|
|
ApplicationCLI cli = createAndGetAppCLI();
|
|
ApplicationId applicationId = ApplicationId.newInstance(1234, 6);
|
|
ApplicationId applicationId = ApplicationId.newInstance(1234, 6);
|
|
@@ -2186,7 +2195,7 @@ public class TestYarnCLI {
|
|
ApplicationCLI cli = createAndGetAppCLI();
|
|
ApplicationCLI cli = createAndGetAppCLI();
|
|
int exitCode = cli.run(new String[] {"applicationattempt", "-fail",
|
|
int exitCode = cli.run(new String[] {"applicationattempt", "-fail",
|
|
"appattempt_1444199730803_0003_000001"});
|
|
"appattempt_1444199730803_0003_000001"});
|
|
- Assert.assertEquals(0, exitCode);
|
|
|
|
|
|
+ assertEquals(0, exitCode);
|
|
|
|
|
|
verify(client).failApplicationAttempt(any(ApplicationAttemptId.class));
|
|
verify(client).failApplicationAttempt(any(ApplicationAttemptId.class));
|
|
verifyNoMoreInteractions(client);
|
|
verifyNoMoreInteractions(client);
|
|
@@ -2552,7 +2561,8 @@ public class TestYarnCLI {
|
|
assertEquals(0, result);
|
|
assertEquals(0, result);
|
|
}
|
|
}
|
|
|
|
|
|
- @Test(timeout = 60000)
|
|
|
|
|
|
+ @Test
|
|
|
|
+ @Timeout(value = 60)
|
|
public void testUpdateApplicationTimeout() throws Exception {
|
|
public void testUpdateApplicationTimeout() throws Exception {
|
|
ApplicationCLI cli = createAndGetAppCLI();
|
|
ApplicationCLI cli = createAndGetAppCLI();
|
|
ApplicationId applicationId = ApplicationId.newInstance(1234, 6);
|
|
ApplicationId applicationId = ApplicationId.newInstance(1234, 6);
|