AHeise commented on a change in pull request #10570: [FLINK-15248][FileSystems] 
Fix the bug in FileUtils#compressDirectory when processing relative directory 
path.
URL: https://github.com/apache/flink/pull/10570#discussion_r358663705
 
 

 ##########
 File path: flink-core/src/test/java/org/apache/flink/util/FileUtilsTest.java
 ##########
 @@ -265,6 +265,18 @@ public void testCompression() throws IOException {
                FileUtils.expandDirectory(zip, new 
Path(extractDir.toAbsolutePath().toString()));
 
                assertDirEquals(compressDir.resolve(originalDir), 
extractDir.resolve(originalDir));
+
+               
FileUtils.deleteDirectory(extractDir.resolve(originalDir).toFile());
+               Files.delete(Paths.get(compressDir.resolve(originalDir) + 
".zip"));
+
+               final java.nio.file.Path relativeCompressDir =
+                       Paths.get(new 
File("").getAbsolutePath()).relativize(compressDir);
+               final Path relativeDirectoryZip = FileUtils.compressDirectory(
+                       new 
Path(relativeCompressDir.resolve(originalDir).toString()),
+                       new Path(compressDir.resolve(originalDir) + ".zip"));
+
+               FileUtils.expandDirectory(relativeDirectoryZip, new 
Path(extractDir.toAbsolutePath().toString()));
+               assertDirEquals(relativeCompressDir.resolve(originalDir), 
extractDir.resolve(originalDir));
 
 Review comment:
   Please add a separate test case (`testCompressionOnRelativePath`?) and 
factor out common code to a private method.

----------------------------------------------------------------
This is an automated message from the Apache Git Service.
To respond to the message, please log on to GitHub and use the
URL above to go to the specific comment.
 
For queries about this service, please contact Infrastructure at:
[email protected]


With regards,
Apache Git Services

Reply via email to