sreejasahithi commented on code in PR #10450:
URL: https://github.com/apache/ozone/pull/10450#discussion_r3385612164
##########
hadoop-ozone/cli-admin/src/test/java/org/apache/hadoop/hdds/scm/cli/datanode/TestDiskBalancerSubCommands.java:
##########
@@ -513,21 +513,23 @@ public void testStatusDiskBalancerWithJson() throws
Exception {
public void testStatusDiskBalancerWithMultipleNodes() throws Exception {
DiskBalancerStatusSubcommand cmd = new DiskBalancerStatusSubcommand();
- DatanodeDiskBalancerInfoProto statusProto1 =
generateRandomStatusProto("host-1");
- DatanodeDiskBalancerInfoProto statusProto2 =
generateRandomStatusProto("host-2");
+ DatanodeDiskBalancerInfoProto statusProto1 =
generateRandomStatusProto("host-2");
+ DatanodeDiskBalancerInfoProto statusProto2 =
generateRandomStatusProto("host-1");
when(mockProtocol.getDiskBalancerInfo())
.thenReturn(statusProto1, statusProto2);
try (DiskBalancerMocks mocks = setupAllMocks()) {
CommandLine c = new CommandLine(cmd);
- c.parseArgs("host-1", "host-2");
+ c.parseArgs("host-2", "host-1");
cmd.call();
String output = outContent.toString(DEFAULT_ENCODING);
- assertTrue(output.contains("host-1"));
- assertTrue(output.contains("host-2"));
+ int host2Index = output.indexOf("host-2");
+ int host1Index = output.indexOf("host-1");
+ assertTrue(host2Index >= 0);
+ assertTrue(host1Index > host2Index, output);
Review Comment:
This file already uses AssertJ (assertThat).
For readability, consider
assertThat(host2Index).isGreaterThanOrEqualTo(0);
assertThat(host1Index).isGreaterThan(host2Index);
##########
hadoop-ozone/cli-admin/src/main/java/org/apache/hadoop/hdds/scm/cli/datanode/DiskBalancerStatusSubcommand.java:
##########
Review Comment:
Not related to your change, but is ConcurrentHashMap needed here?
##########
hadoop-ozone/cli-admin/src/test/java/org/apache/hadoop/hdds/scm/cli/datanode/TestDiskBalancerSubCommands.java:
##########
Review Comment:
`testStatusDiskBalancerWithMultipleNodes` now asserts output order, but
`testStatusDiskBalancerWithStdin` still only checks contains for host-1/host-2
even though stdin order is host-1 then host-2.
Consider applying the same order assertion here so stdin input path is
covered too.
--
This is an automated message from the Apache Git Service.
To respond to the message, please log on to GitHub and use the
URL above to go to the specific comment.
To unsubscribe, e-mail: [email protected]
For queries about this service, please contact Infrastructure at:
[email protected]
---------------------------------------------------------------------
To unsubscribe, e-mail: [email protected]
For additional commands, e-mail: [email protected]