GJL commented on a change in pull request #10152: [FLINK-14466][runtime] Let 
YarnJobClusterEntrypoint use user code class loader
URL: https://github.com/apache/flink/pull/10152#discussion_r347822104
 
 

 ##########
 File path: 
flink-yarn/src/test/java/org/apache/flink/yarn/YarnFileStageTest.java
 ##########
 @@ -158,83 +176,159 @@ static void testCopyFromLocalRecursive(
                        srcPath = new Path(srcDir.getAbsolutePath());
                }
 
-               HashMap<String /* (relative) path */, /* contents */ String> 
srcFiles = new HashMap<>(4);
+               final HashMap<String /* (relative) path */, /* contents */ 
String> srcFiles = new HashMap<>(4);
 
                // create and fill source files
                srcFiles.put("1", "Hello 1");
                srcFiles.put("2", "Hello 2");
                srcFiles.put("nested/3", "Hello nested/3");
                srcFiles.put("nested/4/5", "Hello nested/4/5");
                srcFiles.put("test.jar", "JAR Content");
-               for (Map.Entry<String, String> src : srcFiles.entrySet()) {
-                       File file = new File(srcDir, src.getKey());
-                       //noinspection ResultOfMethodCallIgnored
-                       file.getParentFile().mkdirs();
-                       try (DataOutputStream out = new DataOutputStream(new 
FileOutputStream(file))) {
-                               out.writeUTF(src.getValue());
-                       }
-               }
+
+               generateFilesInDirectory(srcDir, srcFiles);
 
                // copy the created directory recursively:
                try {
-                       List<Path> remotePaths = new ArrayList<>();
-                       HashMap<String, LocalResource> localResources = new 
HashMap<>();
+                       final List<Path> remotePaths = new ArrayList<>();
+                       final HashMap<String, LocalResource> localResources = 
new HashMap<>();
                        final List<String> classpath = 
YarnClusterDescriptor.uploadAndRegisterFiles(
                                Collections.singletonList(new 
File(srcPath.toUri().getPath())),
                                targetFileSystem,
                                targetDir,
                                ApplicationId.newInstance(0, 0),
                                remotePaths,
                                localResources,
+                               localResourceDirectory,
                                new StringBuilder());
 
+                       final Path basePath = new Path(localResourceDirectory, 
srcDir.getName());
+                       final Path nestedPath = new Path(basePath, "nested");
                        assertThat(
                                classpath,
                                Matchers.containsInAnyOrder(
 
 Review comment:
   I will add a static import for `containsInAnyOrder` this before merging.

----------------------------------------------------------------
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