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

    https://github.com/apache/flink/pull/5415#discussion_r167853159
  
    --- Diff: 
flink-core/src/test/java/org/apache/flink/api/common/io/FileInputFormatTest.java
 ---
    @@ -203,7 +390,104 @@ public void 
testGetStatisticsMultipleFilesWithCachedVersion() {
                        Assert.fail(ex.getMessage());
                }
        }
    -
    +   
    +   // -- Multiple Files -- //
    +   
    +   @Test
    +   public void testGetStatisticsMultipleNonExistingFile() throws 
IOException {
    +           final MultiDummyFileInputFormat format = new 
MultiDummyFileInputFormat();
    +           
format.setFilePaths("file:///some/none/existing/directory/","file:///another/non/existing/directory/");
    +           format.configure(new Configuration());
    +           
    +           BaseStatistics stats = format.getStatistics(null);
    +           Assert.assertNull("The file statistics should be null.", stats);
    +   }
    +   
    +   @Test
    +   public void testGetStatisticsMultipleOneFileNoCachedVersion() throws 
IOException {
    +           final long size1 = 1024 * 500;
    +           String tempFile = TestFileUtils.createTempFile(size1);
    +
    +           final long size2 = 1024 * 505;
    +           String tempFile2 = TestFileUtils.createTempFile(size2);
    +
    +           final long totalSize = size1 + size2;
    +           
    +           final MultiDummyFileInputFormat format = new 
MultiDummyFileInputFormat();
    +           format.setFilePaths(tempFile, tempFile2);
    +           format.configure(new Configuration());
    +           
    +           BaseStatistics stats = format.getStatistics(null);
    +           Assert.assertEquals("The file size from the statistics is 
wrong.", totalSize, stats.getTotalInputSize());
    +   }
    +   
    +   @Test
    +   public void 
testGetStatisticsMultipleFilesMultiplePathsNoCachedVersion() throws IOException 
{
    +           final long size1 = 2077;
    +           final long size2 = 31909;
    +           final long size3 = 10;
    +           final long totalSize123 = size1 + size2 + size3;
    +           
    +           String tempDir = TestFileUtils.createTempFileDir(size1, size2, 
size3);
    +           
    +           final long size4 = 2051;
    +           final long size5 = 31902;
    +           final long size6 = 15;
    +           final long totalSize456 = size4 + size5 + size6;
    +           String tempDir2 = TestFileUtils.createTempFileDir(size4, size5, 
size6);
    +
    +           final MultiDummyFileInputFormat format = new 
MultiDummyFileInputFormat();
    +           format.setFilePaths(tempDir, tempDir2);
    +           format.configure(new Configuration());
    +           
    +           BaseStatistics stats = format.getStatistics(null);
    +           Assert.assertEquals("The file size from the statistics is 
wrong.", totalSize123 + totalSize456, stats.getTotalInputSize());
    +   }
    +   
    +   @Test
    +   public void testGetStatisticsMultipleOneFileWithCachedVersion() throws 
IOException {
    +           final long size1 = 50873;
    +           final long cachedSize = 10065;
    --- End diff --
    
    rename to `fakeSize`


---

Reply via email to