HDFS-10571. TestDiskBalancerCommand#testPlanNode failed with IllegalArgumentException. Contributed by Xiaobing Zhou.
Project: http://git-wip-us.apache.org/repos/asf/hadoop/repo Commit: http://git-wip-us.apache.org/repos/asf/hadoop/commit/67fec0c4 Tree: http://git-wip-us.apache.org/repos/asf/hadoop/tree/67fec0c4 Diff: http://git-wip-us.apache.org/repos/asf/hadoop/diff/67fec0c4 Branch: refs/heads/HDFS-1312 Commit: 67fec0c4363a480eaaabcb1b5fbe0cbbabc19a86 Parents: ea8bfc3 Author: Anu Engineer <aengin...@apache.org> Authored: Thu Jun 23 14:48:40 2016 -0700 Committer: Anu Engineer <aengin...@apache.org> Committed: Thu Jun 23 14:48:40 2016 -0700 ---------------------------------------------------------------------- .../command/TestDiskBalancerCommand.java | 17 ++++++++++++++--- 1 file changed, 14 insertions(+), 3 deletions(-) ---------------------------------------------------------------------- http://git-wip-us.apache.org/repos/asf/hadoop/blob/67fec0c4/hadoop-hdfs-project/hadoop-hdfs/src/test/java/org/apache/hadoop/hdfs/server/diskbalancer/command/TestDiskBalancerCommand.java ---------------------------------------------------------------------- diff --git a/hadoop-hdfs-project/hadoop-hdfs/src/test/java/org/apache/hadoop/hdfs/server/diskbalancer/command/TestDiskBalancerCommand.java b/hadoop-hdfs-project/hadoop-hdfs/src/test/java/org/apache/hadoop/hdfs/server/diskbalancer/command/TestDiskBalancerCommand.java index b0821e2..e55c418 100644 --- a/hadoop-hdfs-project/hadoop-hdfs/src/test/java/org/apache/hadoop/hdfs/server/diskbalancer/command/TestDiskBalancerCommand.java +++ b/hadoop-hdfs-project/hadoop-hdfs/src/test/java/org/apache/hadoop/hdfs/server/diskbalancer/command/TestDiskBalancerCommand.java @@ -280,7 +280,7 @@ public class TestDiskBalancerCommand { final String cmdLine = String .format( "hdfs diskbalancer %s", planArg); - runCommand(cmdLine); + runCommand(cmdLine, cluster); } /* Test that illegal arguments are handled correctly*/ @@ -335,12 +335,12 @@ public class TestDiskBalancerCommand { runCommand(cmdLine); } - private List<String> runCommand(final String cmdLine) throws Exception { + private List<String> runCommandInternal(final String cmdLine) throws + Exception { String[] cmds = StringUtils.split(cmdLine, ' '); org.apache.hadoop.hdfs.tools.DiskBalancer db = new org.apache.hadoop.hdfs.tools.DiskBalancer(conf); - FileSystem.setDefaultUri(conf, clusterJson); ByteArrayOutputStream bufOut = new ByteArrayOutputStream(); PrintStream out = new PrintStream(bufOut); db.run(cmds, out); @@ -353,6 +353,17 @@ public class TestDiskBalancerCommand { return outputs; } + private List<String> runCommand(final String cmdLine) throws Exception { + FileSystem.setDefaultUri(conf, clusterJson); + return runCommandInternal(cmdLine); + } + + private List<String> runCommand(final String cmdLine, + MiniDFSCluster miniCluster) throws Exception { + FileSystem.setDefaultUri(conf, miniCluster.getURI()); + return runCommandInternal(cmdLine); + } + /** * Making sure that we can query the node without having done a submit. * @throws Exception --------------------------------------------------------------------- To unsubscribe, e-mail: common-commits-unsubscr...@hadoop.apache.org For additional commands, e-mail: common-commits-h...@hadoop.apache.org