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

ASF GitHub Bot commented on FLINK-5166:
---------------------------------------

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

    https://github.com/apache/flink/pull/2876#discussion_r90249472
  
    --- Diff: 
flink-java/src/test/java/org/apache/flink/api/java/io/TextInputFormatTest.java 
---
    @@ -90,23 +92,23 @@ public void testSimpleRead() {
     
        @Test
        public void testNestedFileRead() {
    -           String[] dirs = new String[] {"tmp/first/", "tmp/second/"};
    -           List<String> expectedFiles = new ArrayList<>();
    -
                try {
    -                   for (String dir: dirs) {
    +                   String tmpDirPath = 
CommonTestUtils.createTempDirectory().getPath();
    +                   String[] dirs = new String[]{tmpDirPath + "/first/", 
tmpDirPath + "/second/"};
    +                   List<String> expectedFiles = new ArrayList<>();
    +                   for (String dir : dirs) {
                                // create input file
                                File tmpDir = new File(dir);
    -                           if (!tmpDir.exists()) {
    -                                   tmpDir.mkdirs();
    +                           if (!tmpDir.exists() && tmpDir.mkdirs()) {
    +                                   tmpDir.deleteOnExit();
                                }
     
    --- End diff --
    
    this section could be a bit cleaner imo:
    ```
    File parentDir = CommonTestUtils.createTempDirectory();
    String[] dirs = new String[]{"first", "second"};
    ...
        File tmpDir= new File(parentDir , dir);
    ```


> TextInputFormatTest.testNestedFileRead
> --------------------------------------
>
>                 Key: FLINK-5166
>                 URL: https://issues.apache.org/jira/browse/FLINK-5166
>             Project: Flink
>          Issue Type: Bug
>          Components: Batch Connectors and Input/Output Formats, Tests
>            Reporter: shijinkui
>
> `mvn clean package -P \!scala-2.11,scala-2.11  -U`
> Failed tests:
>   TextInputFormatTest.testNestedFileRead:140 Test erroneous
> Tests run: 846, Failures: 1, Errors: 0, Skipped: 0



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

Reply via email to