hadoop-common-commits mailing list archives

Site index · List index
Message view « Date » · « Thread »
Top « Date » · « Thread »
From junping...@apache.org
Subject hadoop git commit: YARN-3070. TestRMAdminCLI#testHelp fails for transitionToActive command. (Contributed by Junping Du) (cherry picked from commit 19cbce3898aeee7dd3b46e2c2ffeae25ff6ba88f)
Date Mon, 19 Jan 2015 06:58:00 GMT
Repository: hadoop
Updated Branches:
  refs/heads/branch-2 29551e19e -> ef4d7b73b


YARN-3070. TestRMAdminCLI#testHelp fails for transitionToActive command. (Contributed by Junping
Du)
(cherry picked from commit 19cbce3898aeee7dd3b46e2c2ffeae25ff6ba88f)


Project: http://git-wip-us.apache.org/repos/asf/hadoop/repo
Commit: http://git-wip-us.apache.org/repos/asf/hadoop/commit/ef4d7b73
Tree: http://git-wip-us.apache.org/repos/asf/hadoop/tree/ef4d7b73
Diff: http://git-wip-us.apache.org/repos/asf/hadoop/diff/ef4d7b73

Branch: refs/heads/branch-2
Commit: ef4d7b73b9ecacd743c786362c6d219e9cc66cd2
Parents: 29551e1
Author: Junping Du <junping_du@apache.org>
Authored: Sun Jan 18 23:08:06 2015 -0800
Committer: Junping Du <junping_du@apache.org>
Committed: Sun Jan 18 23:09:24 2015 -0800

----------------------------------------------------------------------
 hadoop-yarn-project/CHANGES.txt                 |  3 +++
 .../hadoop/yarn/client/cli/TestRMAdminCLI.java  | 26 ++++++++++++--------
 2 files changed, 19 insertions(+), 10 deletions(-)
----------------------------------------------------------------------


http://git-wip-us.apache.org/repos/asf/hadoop/blob/ef4d7b73/hadoop-yarn-project/CHANGES.txt
----------------------------------------------------------------------
diff --git a/hadoop-yarn-project/CHANGES.txt b/hadoop-yarn-project/CHANGES.txt
index 7ee91d3..162ef6f 100644
--- a/hadoop-yarn-project/CHANGES.txt
+++ b/hadoop-yarn-project/CHANGES.txt
@@ -348,6 +348,9 @@ Release 2.7.0 - UNRELEASED
     YARN-2815. Excluded transitive dependency of JLine in hadoop-yarn-server-common.
     (Ferdinand Xu via zjshen)
 
+    YARN-3070. TestRMAdminCLI#testHelp fails for transitionToActive command. 
+    (Contributed by Junping Du)
+
 Release 2.6.0 - 2014-11-18
 
   INCOMPATIBLE CHANGES

http://git-wip-us.apache.org/repos/asf/hadoop/blob/ef4d7b73/hadoop-yarn-project/hadoop-yarn/hadoop-yarn-client/src/test/java/org/apache/hadoop/yarn/client/cli/TestRMAdminCLI.java
----------------------------------------------------------------------
diff --git a/hadoop-yarn-project/hadoop-yarn/hadoop-yarn-client/src/test/java/org/apache/hadoop/yarn/client/cli/TestRMAdminCLI.java
b/hadoop-yarn-project/hadoop-yarn/hadoop-yarn-client/src/test/java/org/apache/hadoop/yarn/client/cli/TestRMAdminCLI.java
index 73c3795..92af27d 100644
--- a/hadoop-yarn-project/hadoop-yarn/hadoop-yarn-client/src/test/java/org/apache/hadoop/yarn/client/cli/TestRMAdminCLI.java
+++ b/hadoop-yarn-project/hadoop-yarn/hadoop-yarn-client/src/test/java/org/apache/hadoop/yarn/client/cli/TestRMAdminCLI.java
@@ -333,8 +333,8 @@ public class TestRMAdminCLI {
       testError(new String[] { "-help", "-getGroups" },
           "Usage: yarn rmadmin [-getGroups [username]]", dataErr, 0);
       testError(new String[] { "-help", "-transitionToActive" },
-          "Usage: yarn rmadmin [-transitionToActive <serviceId>" +
-          " [--forceactive]]", dataErr, 0);
+          "Usage: yarn rmadmin [-transitionToActive [--forceactive]" +
+          " <serviceId>]", dataErr, 0);
       testError(new String[] { "-help", "-transitionToStandby" },
           "Usage: yarn rmadmin [-transitionToStandby <serviceId>]", dataErr, 0);
       testError(new String[] { "-help", "-getServiceState" },
@@ -355,19 +355,21 @@ public class TestRMAdminCLI {
       // Test -help when RM HA is enabled
       assertEquals(0, rmAdminCLIWithHAEnabled.run(args));
       oldOutPrintStream.println(dataOut);
-      assertTrue(dataOut
-          .toString()
-          .contains(
-              "yarn rmadmin [-refreshQueues] [-refreshNodes] [-refreshSuper" +
+      String expectedHelpMsg = 
+          "yarn rmadmin [-refreshQueues] [-refreshNodes] [-refreshSuper" +
               "UserGroupsConfiguration] [-refreshUserToGroupsMappings] " +
               "[-refreshAdminAcls] [-refreshServiceAcl] [-getGroup" +
               " [username]] [[-addToClusterNodeLabels [label1,label2,label3]]" +
               " [-removeFromClusterNodeLabels [label1,label2,label3]] [-replaceLabelsOnNode
" +
               "[node1:port,label1,label2 node2:port,label1] [-directlyAccessNodeLabelStore]]
" +
-              "[-transitionToActive <serviceId> [--forceactive]] " + 
+              "[-transitionToActive [--forceactive] <serviceId>] " + 
               "[-transitionToStandby <serviceId>] [-failover" +
               " [--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 {
       System.setOut(oldOutPrintStream);
       System.setErr(oldErrPrintStream);
@@ -543,8 +545,12 @@ public class TestRMAdminCLI {
 
   private void testError(String[] args, String template,
       ByteArrayOutputStream data, int resultCode) throws Exception {
-    assertEquals(resultCode, rmAdminCLI.run(args));
-    assertTrue(data.toString().contains(template));
+    int actualResultCode = rmAdminCLI.run(args);
+    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();
   }
   


Mime
View raw message