tillrohrmann commented on a change in pull request #10076: 
[FLINK-14465][runtime] Let `StandaloneJobClusterEntrypoint` use user code class 
loader
URL: https://github.com/apache/flink/pull/10076#discussion_r342068900
 
 

 ##########
 File path: 
flink-container/src/test/java/org/apache/flink/container/entrypoint/ClassPathJobGraphRetrieverTest.java
 ##########
 @@ -160,6 +238,80 @@ public void testJarFromClassPathSupplier() throws 
IOException {
                assertThat(jarFiles, contains(file1, file2));
        }
 
+       @Test
+       public void testJobGraphRetrievalFailIfJobDirDoesNotHaveEntryClass() 
throws IOException {
+               final File testJar = TestJob.getTestJobJar();
+               final ClassPathJobGraphRetriever classPathJobGraphRetriever = 
new ClassPathJobGraphRetriever(
+                       new JobID(),
+                       SavepointRestoreSettings.none(),
+                       PROGRAM_ARGUMENTS,
+                       null,
+                       // only find the entry class from job dir
+                       () -> Collections.singleton(testJar),
+                       userDirHasNotEntryClass);
+               try {
+                       classPathJobGraphRetriever.retrieveJobGraph(new 
Configuration());
+               } catch (FlinkException e) {
+                       StringWriter errors = new StringWriter();
+                       e.printStackTrace(new PrintWriter(errors));
+                       assertTrue(errors.toString().contains("Failed to find 
job JAR on class path"));
+                       return;
+               }
+
+               Assert.fail("This case should throw exception !");
+       }
+
+       @Test
+       public void 
testJobGraphRetrievalFailIfDoesNotFindTheEntryClassInTheJobDir() throws 
IOException {
+               final ClassPathJobGraphRetriever classPathJobGraphRetriever = 
new ClassPathJobGraphRetriever(
+                       new JobID(),
+                       SavepointRestoreSettings.none(),
+                       PROGRAM_ARGUMENTS,
+                       testEntryClassName,
+                       Collections::emptyList,
+                       userDirHasNotEntryClass);
+               try {
+                       classPathJobGraphRetriever.retrieveJobGraph(new 
Configuration());
+               } catch (FlinkException e) {
+                       StringWriter errors = new StringWriter();
+                       e.printStackTrace(new PrintWriter(errors));
+                       assertTrue(errors
+                               .toString()
+                               
.contains(String.format("java.lang.ClassNotFoundException: %s", 
testEntryClassName)));
+                       return;
+               }
+
+               Assert.fail("This case should throw class not found 
exception!!");
 
 Review comment:
   Same comments as in `testJobGraphRetrievalFailIfJobDirDoesNotHaveEntryClass` 
apply to this test case.

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