xichen01 commented on code in PR #11066:
URL: https://github.com/apache/ozone/pull/11066#discussion_r3860871393


##########
hadoop-ozone/cli-admin/src/test/java/org/apache/hadoop/hdds/scm/cli/datanode/TestListInfoSubcommand.java:
##########
@@ -459,6 +466,54 @@ private void validateOrderingFromTextOutput(String output, 
String orderDirection
     }
   }
 
+  @ParameterizedTest
+  @EnumSource(value = StorageTier.class, names = {"EMPTY"}, mode = 
EnumSource.Mode.EXCLUDE)
+  public void testRelatedPipelineShowsStorageTier(StorageTier tier) throws 
Exception {
+    List<HddsProtos.Node> nodes = getNodeDetails();
+    HddsProtos.Node node = nodes.get(0);
+
+    ScmClient scmClient = mock(ScmClient.class);
+    when(scmClient.queryNode(any(), any(), any(), any())).thenReturn(nodes);
+    when(scmClient.listPipelines()).thenReturn(
+        Collections.singletonList(pipelineContaining(node, tier)));
+
+    CommandLine c = new CommandLine(cmd);
+    c.parseArgs();
+    cmd.execute(scmClient);
+
+    String output = outContent.toString(DEFAULT_ENCODING);
+    assertThat(output).contains("/[" + tier.getTierName() + "]");
+  }
+
+  @Test
+  public void testRelatedPipelineOmitsTierWhenNull() throws Exception {

Review Comment:
   For an old Pipeline, its storage tier is null
   Or you might be using a newer version of the client to access an older 
version cluster



##########
hadoop-ozone/cli-admin/src/main/java/org/apache/hadoop/hdds/scm/cli/datanode/ListInfoSubcommand.java:
##########
@@ -243,4 +245,8 @@ private void printDatanodeInfo(BasicDatanodeInfo dn) {
       System.out.printf("Percentage Used : %.2f%%%n%n", dn.getPercentUsed());
     }
   }
+
+  private static String formatSupportedStorageTier(StorageTier tier) {
+    return tier == null ? "[]" : "[" + tier.getTierName() + "]";

Review Comment:
   From the user's perspective, EMPTY and null can be considered equivalent; 
however, a Pipeline's storage tier cannot be `EMPTY` but can be `null`.
   For an old Pipeline, its storage tier is `null`, in which case it can be 
displayed as []
   
   
   `null` means that no storage tier has been set.
   `EMPTY` explicitly indicates that a storage tier is not supported; this is 
used when defining the fallback storage tier in a storage policy.



-- 
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]

Reply via email to