[ https://issues.apache.org/jira/browse/HDFS-9848?page=com.atlassian.jira.plugin.system.issuetabpanels:comment-tabpanel&focusedCommentId=15174647#comment-15174647 ]
Chris Nauroth commented on HDFS-9848: ------------------------------------- Hi [~anu]. This looks good overall. Just a few minor notes on the tests: {code} try { client = new OzoneClient(String.format("http://localhost:%d", port)); } catch (OzoneException | URISyntaxException e) { Assert.assertTrue("Failed to create an Ozone Client." + e.getMessage() , false); } {code} Usually, I'd just let these exceptions be thrown out of the method. If the exception is thrown, JUnit will report it with a full stack trace to aid troubleshooting. If you prefer to handle the exception so that you can emit the custom "Failed to create" message, then I'd recommend using {{Assert.fail}} instead of an {{Assert.assertTrue}} that fails on purpose. {code} @Test public void testCreateDuplicateVolume() throws OzoneException { try { client.setUserAuth(OzoneConsts.OZONE_SIMPLE_HDFS_USER); client.createVolume("testVol", "bilbo", "100TB"); client.createVolume("testVol", "bilbo", "100TB"); } catch (Exception ex) { // OZone will throw saying volume already exists assertNotNull(ex); } } {code} As currently written, this test always passes, even when it shouldn't. If any of the client calls fails for any reason, then it will go to the exception handler. {{ex}} is guaranteed to be non-null always, so the {{assertNotNull}} is effectively a no-op and the test passes. If all 3 client calls succeed, then the overall test is a success, even though we wanted it to cover duplicate volume error handling. From debugging, I can see that what is actually happening when the test runs is it throws "java.lang.IllegalArgumentException: Bucket or Volume name does not support uppercase characters", so the test also needs to be changed to use a different volume name. > Ozone: Add Ozone Client lib for volume handling > ----------------------------------------------- > > Key: HDFS-9848 > URL: https://issues.apache.org/jira/browse/HDFS-9848 > Project: Hadoop HDFS > Issue Type: Sub-task > Components: ozone > Affects Versions: HDFS-7240 > Reporter: Anu Engineer > Assignee: Anu Engineer > Fix For: HDFS-7240 > > Attachments: HDFS-9848-HDFS-7240.001.patch, > HDFS-9848-HDFS-7240.002.patch, HDFS-9848-HDFS-7240.003.patch, > HDFS-9848-HDFS-7240.004.patch > > > Add a simple client lib for volume handling. This is used primarily to make > writing tests simpler. -- This message was sent by Atlassian JIRA (v6.3.4#6332)