HDFS-17448. Enhance the stability of the unit test TestDiskBalancerCommand (#6690). Contributed by Haiyang Hu

Signed-off-by: Ayush Saxena <ayushsaxena@apache.org>
This commit is contained in:
huhaiyang 2024-03-31 01:21:05 +08:00 committed by GitHub
parent 06db6289cb
commit 4807815e1c
No known key found for this signature in database
GPG Key ID: B5690EEEBB952194

View File

@ -834,8 +834,13 @@ public void testDiskBalancerQueryWithoutSubmitAndMultipleNodes() throws Exceptio
.getIpcPort(), dataNode2.getIpcPort());
final String cmdLine = String.format("hdfs diskbalancer %s", queryArg);
List<String> outputs = runCommand(cmdLine);
assertThat(outputs.get(1), containsString("localhost:" + dataNode1.getIpcPort()));
assertThat(outputs.get(6), containsString("localhost:" + dataNode2.getIpcPort()));
assertEquals(12, outputs.size());
assertTrue("Expected outputs: " + outputs,
outputs.get(1).contains("localhost:" + dataNode1.getIpcPort()) ||
outputs.get(6).contains("localhost:" + dataNode1.getIpcPort()));
assertTrue("Expected outputs: " + outputs,
outputs.get(1).contains("localhost:" + dataNode2.getIpcPort()) ||
outputs.get(6).contains("localhost:" + dataNode2.getIpcPort()));
} finally {
miniDFSCluster.shutdown();
}