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

    https://github.com/apache/flink/pull/6147#discussion_r195107099
  
    --- Diff: 
flink-runtime/src/test/java/org/apache/flink/runtime/filecache/FileCacheDirectoriesTest.java
 ---
    @@ -206,4 +200,49 @@ public void testDirectoryCleanUp() throws Exception {
                        }
                }
        }
    +
    +   @Test
    +   public void testCompression() throws IOException {
    +           final java.nio.file.Path compressDir = 
temporaryFolder.newFolder("compressDir").toPath();
    +           final java.nio.file.Path extractDir = 
temporaryFolder.newFolder("extractDir").toPath();
    +
    +           final java.nio.file.Path originalDir = Paths.get("rootDir");
    +           final java.nio.file.Path emptySubDir = 
originalDir.resolve("emptyDir");
    +           final java.nio.file.Path fullSubDir = 
originalDir.resolve("fullDir");
    +           final java.nio.file.Path file1 = originalDir.resolve("file1");
    +           final java.nio.file.Path file2 = originalDir.resolve("file2");
    +           final java.nio.file.Path file3 = fullSubDir.resolve("file3");
    +
    +           Files.createDirectory(compressDir.resolve(originalDir));
    +           Files.createDirectory(compressDir.resolve(emptySubDir));
    +           Files.createDirectory(compressDir.resolve(fullSubDir));
    +           Files.copy(new 
ByteArrayInputStream(testFileContent.getBytes(StandardCharsets.UTF_8)), 
compressDir.resolve(file1));
    +           Files.createFile(compressDir.resolve(file2));
    +           Files.copy(new 
ByteArrayInputStream(testFileContent.getBytes(StandardCharsets.UTF_8)), 
compressDir.resolve(file3));
    +
    +           final Path zip = FileCache.compressDirectory(new 
Path(compressDir.resolve(originalDir).toString()));
    +
    +           FileCache.expandDirectory(new File(zip.getPath()), 
extractDir.toFile(), false);
    +
    +           assertTrue(Files.exists(extractDir.resolve(originalDir)));
    --- End diff --
    
    I'll try to come up with something. The linked solution does not cover 
empty directories and does not detect additional files in one direction (and 
I'd prefer if we didn't have to run it twice with reverse arguments).


---

Reply via email to