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:
       Unfortunately `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: [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