hadoop-hdfs-issues mailing list archives

Site index · List index
Message view « Date » · « Thread »
Top « Date » · « Thread »
From "Chris Nauroth (JIRA)" <j...@apache.org>
Subject [jira] [Commented] (HDFS-9848) Ozone: Add Ozone Client lib for volume handling
Date Tue, 01 Mar 2016 23:48:18 GMT

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

    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);

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.

  public void testCreateDuplicateVolume() throws OzoneException {
    try {
      client.createVolume("testVol", "bilbo", "100TB");
      client.createVolume("testVol", "bilbo", "100TB");
    } catch (Exception ex) {
      // OZone will throw saying volume already exists

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,
> Add a simple client lib for volume handling. This is used primarily to make writing tests

This message was sent by Atlassian JIRA

View raw message