architgyl commented on code in PR #23164:
URL: https://github.com/apache/flink/pull/23164#discussion_r1291656637
##########
flink-yarn/src/test/java/org/apache/flink/yarn/YarnApplicationFileUploaderTest.java:
##########
@@ -73,6 +74,38 @@ void testRegisterProvidedLocalResources(@TempDir File
flinkLibDir) throws IOExce
}
}
+ @Test
+ void testRegisterProvidedLocalResourcesWithParentDir(@TempDir File
flinkLibDir)
+ throws IOException {
+ final Map<String, String> filesWithParentDir = getFilesWithParentDir();
+
+ generateFilesInDirectory(flinkLibDir, filesWithParentDir);
+
+ try (final YarnApplicationFileUploader yarnApplicationFileUploader =
+ YarnApplicationFileUploader.from(
+ FileSystem.get(new YarnConfiguration()),
+ new Path(flinkLibDir.toURI()),
+ Collections.singletonList(new
Path(flinkLibDir.toURI())),
+ ApplicationId.newInstance(0, 0),
+ DFSConfigKeys.DFS_REPLICATION_DEFAULT)) {
+
+ List<String> classPath =
yarnApplicationFileUploader.registerProvidedLocalResources();
+
+ Set<String> expectedClassPathEntries = new HashSet<>();
+ Set<String> resources = new HashSet<>();
+ Set<String> resourcesDir = new HashSet<>();
+ for (String filePath : filesWithParentDir.keySet()) {
+ String parentDir = new Path(filePath).getParent().toString();
+ resourcesDir.add(parentDir);
+ resources.add(filePath);
+ }
+
resourcesDir.stream().sorted().forEach(expectedClassPathEntries::add);
+ resources.stream().sorted().forEach(expectedClassPathEntries::add);
+
+
assertThat(classPath).containsExactlyInAnyOrderElementsOf(expectedClassPathEntries);
Review Comment:
Missed using List instead of Set. Updated it and also manually constructing
the classpath.
--
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]