NicoK commented on a change in pull request #10113: [FLINK-13749][client] Make
PackagedProgram respect classloading policy
URL: https://github.com/apache/flink/pull/10113#discussion_r345252913
##########
File path:
flink-tests/src/test/java/org/apache/flink/test/classloading/ClassLoaderITCase.java
##########
@@ -384,4 +390,72 @@ public void testDisposeSavepointWithCustomKvState()
throws Exception {
invokeThread.join(deadline.timeLeft().toMillis());
assertFalse("Program invoke thread still running",
invokeThread.isAlive());
}
+
+ @Test
+ public void testProgramWithChildFirstClassLoader() throws IOException,
ProgramInvocationException {
+ // We have two files named test-resource in src/resource
(parent classloader classpath) and
+ // tmp folders (child classloader classpath) respectively.
+ String childResourceDirName = "child0";
+ String testResourceName = "test-resource";
+ File childResourceDir = FOLDER.newFolder(childResourceDirName);
+ File childResource = new
File(childResourceDir.getAbsolutePath() + File.separator + testResourceName);
+ Files.touch(childResource);
+
+ TestStreamEnvironment.setAsContext(
+ miniClusterResource.getMiniCluster(),
+ parallelism,
+ Collections.singleton(new
Path(CLASSLOADING_POLICY_JAR_PATH)),
+ Collections.emptyList());
+
+ // default child first classloading
+ final PackagedProgram childFirstProgram =
PackagedProgram.newBuilder()
+ .setJarFile(new File(CLASSLOADING_POLICY_JAR_PATH))
+
.setUserClassPaths(Lists.newArrayList(childResourceDir.toURI().toURL()))
+ .setArguments(new String[]{testResourceName,
childResourceDirName})
Review comment:
nit: we can go without the explicit array creation
```suggestion
.setArguments(testResourceName, childResourceDirName)
```
----------------------------------------------------------------
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