tillrohrmann commented on a change in pull request #15999:
URL: https://github.com/apache/flink/pull/15999#discussion_r758473646
##########
File path: flink-core/src/test/java/org/apache/flink/util/FileUtilsTest.java
##########
@@ -331,6 +331,25 @@ public void testListAFileFailsBecauseDirectoryIsExpected()
throws IOException {
FileUtils.listFilesInDirectory(file.toPath(), FileUtils::isJarFile);
}
+ @Test
+ public void testFollowSymbolicLink() throws IOException {
+ final String tmpRoot = tmp.getRoot().getPath();
+ final File folder = tmp.newFolder("a");
+ final File file = tmp.newFile("a/a.jar");
+
+ java.nio.file.Path linkPath = Paths.get(tmpRoot, "a.lnk");
+ Files.createSymbolicLink(linkPath, folder.toPath());
+ Collection<java.nio.file.Path> paths =
+ FileUtils.listFilesInDirectory(linkPath, FileUtils::isJarFile);
+ // <jUnit>/a.lnk/a.jar
+ assertEquals(1, paths.size());
+ java.nio.file.Path result = paths.iterator().next();
+ // file is a/a.jar
+ // result is a.lnk/a.jar
+ // full paths aren't identical, validate file name only.
+ assertEquals(result.getFileName().toString(), file.getName());
Review comment:
Why not simply asserting on `a.lnk/a.jar`?
--
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.
To unsubscribe, e-mail: [email protected]
For queries about this service, please contact Infrastructure at:
[email protected]