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

ASF GitHub Bot commented on HADOOP-12984:
-----------------------------------------

Github user aajisaka commented on a diff in the pull request:

    https://github.com/apache/hadoop/pull/89#discussion_r58492524
  
    --- Diff: 
hadoop-common-project/hadoop-common/src/test/java/org/apache/hadoop/fs/TestFileUtil.java
 ---
    @@ -55,9 +56,11 @@
     public class TestFileUtil {
       private static final Log LOG = LogFactory.getLog(TestFileUtil.class);
     
    -  private static final String TEST_ROOT_DIR = System.getProperty(
    -      "test.build.data", "/tmp") + "/fu";
    +  private static final String TEST_ROOT_DIR =
    +      new File(GenericTestUtils.getTestDir(), "fu").getAbsolutePath();
       private static final File TEST_DIR = new File(TEST_ROOT_DIR);
    +  private static final String  cacheDir = 
System.getProperty("test.cache.data",
    +      new File(TEST_DIR, "cache").getAbsolutePath());
    --- End diff --
    
    * The code creates String by `File.getAbsolutePath()` and then creates File 
by `new File(String)`. It can be simplified by the following and 
`TEST_ROOT_DIR` can be removed.
    ```
     private static final File TEST_DIR = new 
File(GenericTestUtils.getTestDir(), "fu");
    ```
    
    * `cacheDir` is unused.


> Add GenericTestUtils.getTestDir method and use it for temporary directory in 
> tests
> ----------------------------------------------------------------------------------
>
>                 Key: HADOOP-12984
>                 URL: https://issues.apache.org/jira/browse/HADOOP-12984
>             Project: Hadoop Common
>          Issue Type: Improvement
>          Components: build, test
>    Affects Versions: 3.0.0
>            Reporter: Steve Loughran
>            Assignee: Steve Loughran
>         Attachments: HADOOP-12984-003.patch, HDFS-9263-001.patch, 
> HDFS-9263-002.patch, HDFS-9263-003.patch
>
>
> We have seen some tests had been used the path {{test/build/data}} to store 
> files, so leaking files which fail the new post-build RAT test checks on 
> Jenkins (and dirtying all development systems with paths which {{mvn clean}} 
> will miss.
> In order not to occur these bugs such as MAPREDUCE-6589 and HDFS-9571 again, 
> we'd like to introduce new utility methods to get a temporary directory path 
> easily, and use the methods in tests.



--
This message was sent by Atlassian JIRA
(v6.3.4#6332)

Reply via email to