You are viewing a plain text version of this content. The canonical link for it is here.
Posted to issues@ozone.apache.org by GitBox <gi...@apache.org> on 2021/10/06 08:18:34 UTC

[GitHub] [ozone] smengcl commented on a change in pull request #2713: HDDS-5824. `ozone sh volume list` should print valid JSON array

smengcl commented on a change in pull request #2713:
URL: https://github.com/apache/ozone/pull/2713#discussion_r722996549



##########
File path: hadoop-ozone/integration-test/src/test/java/org/apache/hadoop/ozone/shell/TestOzoneShellHA.java
##########
@@ -855,4 +861,36 @@ public void testShQuota() throws Exception {
     objectStore.getVolume("vol4").deleteBucket("buck4");
     objectStore.deleteVolume("vol4");
   }
+
+  @Test
+  public void testListVolumeShouldPrintValidJson()
+      throws UnsupportedEncodingException {
+
+    final List<String> volumesForThisTest =
+        Arrays.asList("random-vol1", "random-vol2", "random-vol3");
+
+    // Create test volumes
+    volumesForThisTest.forEach(vol ->
+        execute(ozoneShell, new String[] {"volume", "create", vol}));
+    out.reset();
+
+    execute(ozoneShell, new String[] {"volume", "list"});
+
+    // Expect proper JSON output
+    final ArrayList<LinkedTreeMap<String, String>> outArray =
+        new Gson().fromJson(out.toString(DEFAULT_ENCODING), ArrayList.class);

Review comment:
       No. The `findbugs` complains if I omit the `UTF_8` encoding.
   ```
   H I Dm: Found reliance on default encoding in org.apache.hadoop.ozone.shell.TestOzoneShellHA.testListVolumeShouldOutputValidJson(): java.io.ByteArrayOutputStream.toString()  At TestOzoneShellHA.java:[line 878]
   ```
   https://github.com/apache/ozone/runs/3809056152




-- 
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: issues-unsubscribe@ozone.apache.org

For queries about this service, please contact Infrastructure at:
users@infra.apache.org



---------------------------------------------------------------------
To unsubscribe, e-mail: issues-unsubscribe@ozone.apache.org
For additional commands, e-mail: issues-help@ozone.apache.org