Skip to content

Commit 885da52

Browse files
committed
HDFS-17361. Fix UT and Checkstytle
1 parent 11dc186 commit 885da52

File tree

1 file changed

+8
-8
lines changed

1 file changed

+8
-8
lines changed

hadoop-hdfs-project/hadoop-hdfs/src/test/java/org/apache/hadoop/hdfs/server/diskbalancer/command/TestDiskBalancerCommand.java

Lines changed: 8 additions & 8 deletions
Original file line numberDiff line numberDiff line change
@@ -820,11 +820,11 @@ private List<String> runCommand(
820820
*/
821821
@Test
822822
public void testDiskBalancerQueryWithoutSubmitAndMultipleNodes() throws Exception {
823-
Configuration conf = new HdfsConfiguration();
824-
conf.setBoolean(DFSConfigKeys.DFS_DISK_BALANCER_ENABLED, true);
823+
Configuration hdfsConf = new HdfsConfiguration();
824+
hdfsConf.setBoolean(DFSConfigKeys.DFS_DISK_BALANCER_ENABLED, true);
825825
final int numDatanodes = 2;
826826
File basedir = new File(GenericTestUtils.getRandomizedTempPath());
827-
MiniDFSCluster miniDFSCluster = new MiniDFSCluster.Builder(conf, basedir)
827+
MiniDFSCluster miniDFSCluster = new MiniDFSCluster.Builder(hdfsConf, basedir)
828828
.numDataNodes(numDatanodes).build();
829829
try {
830830
miniDFSCluster.waitActive();
@@ -834,8 +834,8 @@ public void testDiskBalancerQueryWithoutSubmitAndMultipleNodes() throws Exceptio
834834
.getIpcPort(), dataNode2.getIpcPort());
835835
final String cmdLine = String.format("hdfs diskbalancer %s", queryArg);
836836
List<String> outputs = runCommand(cmdLine);
837-
assertTrue(outputs.get(1).contains("localhost:" + dataNode1.getIpcPort()));
838-
assertTrue(outputs.get(6).contains("localhost:" + dataNode2.getIpcPort()));
837+
assertThat(outputs.get(1), containsString("localhost:" + dataNode1.getIpcPort()));
838+
assertThat(outputs.get(6), containsString("localhost:" + dataNode2.getIpcPort()));
839839
} finally {
840840
miniDFSCluster.shutdown();
841841
}
@@ -847,11 +847,11 @@ public void testDiskBalancerQueryWithoutSubmitAndMultipleNodes() throws Exceptio
847847
*/
848848
@Test
849849
public void testDiskBalancerQueryWithoutSubmit() throws Exception {
850-
Configuration conf = new HdfsConfiguration();
851-
conf.setBoolean(DFSConfigKeys.DFS_DISK_BALANCER_ENABLED, true);
850+
Configuration hdfsConf = new HdfsConfiguration();
851+
hdfsConf.setBoolean(DFSConfigKeys.DFS_DISK_BALANCER_ENABLED, true);
852852
final int numDatanodes = 2;
853853
File basedir = new File(GenericTestUtils.getRandomizedTempPath());
854-
MiniDFSCluster miniDFSCluster = new MiniDFSCluster.Builder(conf, basedir)
854+
MiniDFSCluster miniDFSCluster = new MiniDFSCluster.Builder(hdfsConf, basedir)
855855
.numDataNodes(numDatanodes).build();
856856
try {
857857
miniDFSCluster.waitActive();

0 commit comments

Comments
 (0)