tillrohrmann commented on a change in pull request #15999:
URL: https://github.com/apache/flink/pull/15999#discussion_r757602145
##########
File path: flink-yarn/src/test/java/org/apache/flink/yarn/YarnFileStageTest.java
##########
@@ -21,6 +21,7 @@
import org.apache.flink.util.OperatingSystem;
import org.apache.flink.util.TestLogger;
+import com.google.common.collect.Lists;
Review comment:
Instead of directly using Guava you should use the `flink-shaded-guava`
version.
##########
File path: flink-core/src/test/java/org/apache/flink/util/FileUtilsTest.java
##########
@@ -331,6 +331,22 @@ public void testListAFileFailsBecauseDirectoryIsExpected()
throws IOException {
FileUtils.listFilesInDirectory(file.toPath(), FileUtils::isJarFile);
}
+ @Test
+ public void testFollowSymbolicLink() throws IOException {
+ final String fileName = "a/a.jar";
+ File folder = tmp.newFolder("a");
+ final File file = tmp.newFile(fileName);
+
+ java.nio.file.Path linkPath = Paths.get(folder.getParent(), "a.lnk");
+ Files.createSymbolicLink(linkPath, file.getParentFile().toPath());
Review comment:
Instead of jumping back and forth between the folders can we simplify
this a bit? For example `File file = new File(folder, "a.jar");
file.createNewFile()`. Or `Files.createSymbolicLink(linkPath, folder.toPath())`.
##########
File path: flink-core/src/test/java/org/apache/flink/util/FileUtilsTest.java
##########
@@ -331,6 +331,22 @@ public void testListAFileFailsBecauseDirectoryIsExpected()
throws IOException {
FileUtils.listFilesInDirectory(file.toPath(), FileUtils::isJarFile);
}
+ @Test
+ public void testFollowSymbolicLink() throws IOException {
+ final String fileName = "a/a.jar";
+ File folder = tmp.newFolder("a");
+ final File file = tmp.newFile(fileName);
+
+ java.nio.file.Path linkPath = Paths.get(folder.getParent(), "a.lnk");
+ Files.createSymbolicLink(linkPath, file.getParentFile().toPath());
+ Collection<java.nio.file.Path> paths =
+ FileUtils.listFilesInDirectory(linkPath.toRealPath(),
FileUtils::isJarFile);
Review comment:
Doesn't `toRealPath` resolves the symbolic link already? Then this test
is not really testing the new functionality contained in `listFilesInDirectory`.
--
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]