HDFS-10571. TestDiskBalancerCommand#testPlanNode failed with IllegalArgumentException. Contributed by Xiaobing Zhou.

This commit is contained in:
Anu Engineer 2016-06-23 14:48:40 -07:00 committed by Arpit Agarwal
parent 8a6e354122
commit b2584bee45

View File

@ -280,7 +280,7 @@ public void testPlanNode() throws Exception {
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 void testHelpCommand() throws Exception {
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 @@ private List<String> runCommand(final String cmdLine) throws Exception {
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