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

    https://github.com/apache/flink/pull/2109#discussion_r73162978
  
    --- Diff: 
flink-core/src/test/java/org/apache/flink/api/common/io/FileInputFormatTest.java
 ---
    @@ -257,41 +257,22 @@ public void testFileInputSplit() {
        public void testIgnoredUnderscoreFiles() {
                try {
                        final String contents = "CONTENTS";
    -                   
    +
                        // create some accepted, some ignored files
    -                   
    -                   File tempDir = new 
File(System.getProperty("java.io.tmpdir"));
    -                   File f;
    -                   do {
    -                           f = new File(tempDir, 
TestFileUtils.randomFileName(""));
    -                   }
    -                   while (f.exists());
     
    -                   assertTrue(f.mkdirs());
    -                   f.deleteOnExit();
    -                   
    -                   File child1 = new File(f, "dataFile1.txt");
    -                   File child2 = new File(f, "another_file.bin");
    -                   File luigiFile = new File(f, "_luigi");
    -                   File success = new File(f, "_SUCCESS");
    -                   
    -                   File[] files = { child1, child2, luigiFile, success };
    -                   
    -                   for (File child : files) {
    -                           child.deleteOnExit();
    -                   
    -                           BufferedWriter out = new BufferedWriter(new 
FileWriter(child));
    -                           try { 
    -                                   out.write(contents);
    -                           } finally {
    -                                   out.close();
    -                           }
    -                   }
    +                   File tempDirectory = createTempDirectory();
                        
    +                   File child1 = new File(tempDirectory, "dataFile1.txt");
    +                   File child2 = new File(tempDirectory, 
"another_file.bin");
    +                   File luigiFile = new File(tempDirectory, "_luigi");
    +                   File success = new File(tempDirectory, "_SUCCESS");
    +
    +                   createTempFiles(contents.getBytes(), child1, child2, 
luigiFile, success);
    --- End diff --
    
    You could actually use `TemporaryFolder` here to create the root. It would 
be cleaned up automatically by junit.


---
If your project is set up for it, you can reply to this email and have your
reply appear on GitHub as well. If your project does not have this feature
enabled and wishes so, or if the feature is enabled but not working, please
contact infrastructure at infrastruct...@apache.org or file a JIRA ticket
with INFRA.
---

Reply via email to