YARN-3070. TestRMAdminCLI#testHelp fails for transitionToActive command. (Contributed by Junping Du)
(cherry picked from commit 19cbce3898
)
This commit is contained in:
parent
29551e19ef
commit
ef4d7b73b9
|
@ -348,6 +348,9 @@ Release 2.7.0 - UNRELEASED
|
||||||
YARN-2815. Excluded transitive dependency of JLine in hadoop-yarn-server-common.
|
YARN-2815. Excluded transitive dependency of JLine in hadoop-yarn-server-common.
|
||||||
(Ferdinand Xu via zjshen)
|
(Ferdinand Xu via zjshen)
|
||||||
|
|
||||||
|
YARN-3070. TestRMAdminCLI#testHelp fails for transitionToActive command.
|
||||||
|
(Contributed by Junping Du)
|
||||||
|
|
||||||
Release 2.6.0 - 2014-11-18
|
Release 2.6.0 - 2014-11-18
|
||||||
|
|
||||||
INCOMPATIBLE CHANGES
|
INCOMPATIBLE CHANGES
|
||||||
|
|
|
@ -333,8 +333,8 @@ public class TestRMAdminCLI {
|
||||||
testError(new String[] { "-help", "-getGroups" },
|
testError(new String[] { "-help", "-getGroups" },
|
||||||
"Usage: yarn rmadmin [-getGroups [username]]", dataErr, 0);
|
"Usage: yarn rmadmin [-getGroups [username]]", dataErr, 0);
|
||||||
testError(new String[] { "-help", "-transitionToActive" },
|
testError(new String[] { "-help", "-transitionToActive" },
|
||||||
"Usage: yarn rmadmin [-transitionToActive <serviceId>" +
|
"Usage: yarn rmadmin [-transitionToActive [--forceactive]" +
|
||||||
" [--forceactive]]", dataErr, 0);
|
" <serviceId>]", dataErr, 0);
|
||||||
testError(new String[] { "-help", "-transitionToStandby" },
|
testError(new String[] { "-help", "-transitionToStandby" },
|
||||||
"Usage: yarn rmadmin [-transitionToStandby <serviceId>]", dataErr, 0);
|
"Usage: yarn rmadmin [-transitionToStandby <serviceId>]", dataErr, 0);
|
||||||
testError(new String[] { "-help", "-getServiceState" },
|
testError(new String[] { "-help", "-getServiceState" },
|
||||||
|
@ -355,19 +355,21 @@ public class TestRMAdminCLI {
|
||||||
// Test -help when RM HA is enabled
|
// Test -help when RM HA is enabled
|
||||||
assertEquals(0, rmAdminCLIWithHAEnabled.run(args));
|
assertEquals(0, rmAdminCLIWithHAEnabled.run(args));
|
||||||
oldOutPrintStream.println(dataOut);
|
oldOutPrintStream.println(dataOut);
|
||||||
assertTrue(dataOut
|
String expectedHelpMsg =
|
||||||
.toString()
|
|
||||||
.contains(
|
|
||||||
"yarn rmadmin [-refreshQueues] [-refreshNodes] [-refreshSuper" +
|
"yarn rmadmin [-refreshQueues] [-refreshNodes] [-refreshSuper" +
|
||||||
"UserGroupsConfiguration] [-refreshUserToGroupsMappings] " +
|
"UserGroupsConfiguration] [-refreshUserToGroupsMappings] " +
|
||||||
"[-refreshAdminAcls] [-refreshServiceAcl] [-getGroup" +
|
"[-refreshAdminAcls] [-refreshServiceAcl] [-getGroup" +
|
||||||
" [username]] [[-addToClusterNodeLabels [label1,label2,label3]]" +
|
" [username]] [[-addToClusterNodeLabels [label1,label2,label3]]" +
|
||||||
" [-removeFromClusterNodeLabels [label1,label2,label3]] [-replaceLabelsOnNode " +
|
" [-removeFromClusterNodeLabels [label1,label2,label3]] [-replaceLabelsOnNode " +
|
||||||
"[node1:port,label1,label2 node2:port,label1] [-directlyAccessNodeLabelStore]] " +
|
"[node1:port,label1,label2 node2:port,label1] [-directlyAccessNodeLabelStore]] " +
|
||||||
"[-transitionToActive <serviceId> [--forceactive]] " +
|
"[-transitionToActive [--forceactive] <serviceId>] " +
|
||||||
"[-transitionToStandby <serviceId>] [-failover" +
|
"[-transitionToStandby <serviceId>] [-failover" +
|
||||||
" [--forcefence] [--forceactive] <serviceId> <serviceId>] " +
|
" [--forcefence] [--forceactive] <serviceId> <serviceId>] " +
|
||||||
"[-getServiceState <serviceId>] [-checkHealth <serviceId>] [-help [cmd]]"));
|
"[-getServiceState <serviceId>] [-checkHealth <serviceId>] [-help [cmd]]";
|
||||||
|
String actualHelpMsg = dataOut.toString();
|
||||||
|
assertTrue(String.format("Help messages: %n " + actualHelpMsg + " %n doesn't include expected " +
|
||||||
|
"messages: %n" + expectedHelpMsg), actualHelpMsg.contains(expectedHelpMsg
|
||||||
|
));
|
||||||
} finally {
|
} finally {
|
||||||
System.setOut(oldOutPrintStream);
|
System.setOut(oldOutPrintStream);
|
||||||
System.setErr(oldErrPrintStream);
|
System.setErr(oldErrPrintStream);
|
||||||
|
@ -543,8 +545,12 @@ public class TestRMAdminCLI {
|
||||||
|
|
||||||
private void testError(String[] args, String template,
|
private void testError(String[] args, String template,
|
||||||
ByteArrayOutputStream data, int resultCode) throws Exception {
|
ByteArrayOutputStream data, int resultCode) throws Exception {
|
||||||
assertEquals(resultCode, rmAdminCLI.run(args));
|
int actualResultCode = rmAdminCLI.run(args);
|
||||||
assertTrue(data.toString().contains(template));
|
assertEquals("Expected result code: " + resultCode +
|
||||||
|
", actual result code is: " + actualResultCode, resultCode, actualResultCode);
|
||||||
|
assertTrue(String.format("Expected error message: %n" + template +
|
||||||
|
" is not included in messages: %n" + data.toString()),
|
||||||
|
data.toString().contains(template));
|
||||||
data.reset();
|
data.reset();
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
Loading…
Reference in New Issue