[ 
https://issues.apache.org/jira/browse/HADOOP-14170?page=com.atlassian.jira.plugin.system.issuetabpanels:comment-tabpanel&focusedCommentId=15904301#comment-15904301
 ] 

Mingliang Liu edited comment on HADOOP-14170 at 3/10/17 8:08 AM:
-----------------------------------------------------------------

One simple solution is to clean up this directory as well in {{tearDown()}} 
method. This is enough because subclass may need to use different test root 
(e.g. S3A using /forkid for parallel tests), but the existing tests are still 
using {{/test}} instead.

Another approach is to use method-specific sub-directory for each test case in 
which way they don't interfere with each other. But we still need to clean up 
both {{/test}} and {{/user/bob/test}} after the whole test. Or we can address 
that later after this patch.

I think a feasible solution is to always use {{path("test")}} for normal tests 
except those tests against root (e.g. {{testRootDirAlwaysExists()}}) in which 
case we have to use {{path("/test")}}. This should be clear in each test case - 
test root or not. I'll upload a patch for this solution.


was (Author: liuml07):
One simple solution is to clean up this directory as well in {{tearDown()}} 
method. This is ideal though.

Another approach is to use method-specific sub-directory for each test case in 
which way they don't interfere with each other. But we still need to clean up 
both {{/test}} and {{/user/bob/test}} after the whole test.

I think a good solution is to always use {{path("test")}} for normal tests 
except tests against root (e.g. {{testRootDirAlwaysExists()}}) in which case we 
use {{path("/test")}} instead. This should be clear in each test case - test 
root or not. I'll upload a patch for this solution.

> FileSystemContractBaseTest is not cleaning up test directory clearly
> --------------------------------------------------------------------
>
>                 Key: HADOOP-14170
>                 URL: https://issues.apache.org/jira/browse/HADOOP-14170
>             Project: Hadoop Common
>          Issue Type: Bug
>          Components: fs
>            Reporter: Mingliang Liu
>            Assignee: Mingliang Liu
>
> In {{FileSystemContractBaseTest::tearDown()}} method, it cleans up the 
> {{path("/test")}} directory, which will be qualified as {{/test}} (against 
> root instead of working directory because it's absolute):
> {code}
>   @Override
>   protected void tearDown() throws Exception {
>     try {
>       if (fs != null) {
>         fs.delete(path("/test"), true);
>       }
>     } catch (IOException e) {
>       LOG.error("Error deleting /test: " + e, e);
>     }
>   }
> {code}
> But in the test, it uses {{path("test")}} sometimes, which will be made 
> qualified against the working directory (e.g. {{/user/bob/test}}).
> This makes some tests fail intermittently, e.g. 
> {{ITestS3AFileSystemContract}}. Also see the discussion in [HADOOP-13934].



--
This message was sent by Atlassian JIRA
(v6.3.15#6346)

---------------------------------------------------------------------
To unsubscribe, e-mail: [email protected]
For additional commands, e-mail: [email protected]

Reply via email to