zentol commented on a change in pull request #7717: [FLINK-11533] [container] 
Add option parse JAR manifest for jobClassName
URL: https://github.com/apache/flink/pull/7717#discussion_r258824634
 
 

 ##########
 File path: 
flink-container/src/test/java/org/apache/flink/container/entrypoint/ClassPathJobGraphRetrieverTest.java
 ##########
 @@ -60,6 +66,42 @@ public void testJobGraphRetrieval() throws FlinkException {
                assertEquals(jobGraph.getJobID(), jobId);
        }
 
+       @Test
+       public void testJobGraphFromJarFile() throws FileNotFoundException, 
FlinkException {
+               final String jobClassName = 
fromJar(TestJob.getTestJobJar().getAbsolutePath());
+               final JobID jobId = new JobID();
+
+               final ClassPathJobGraphRetriever classPathJobGraphRetriever = 
new ClassPathJobGraphRetriever(
+                       jobClassName,
+                       jobId,
+                       SavepointRestoreSettings.none(),
+                       PROGRAM_ARGUMENTS);
+
+               final JobGraph jobGraph = 
classPathJobGraphRetriever.retrieveJobGraph(new Configuration());
+
+               assertThat(jobGraph.getName(), 
is(equalTo(TestJob.class.getCanonicalName() + "-suffix")));
+               assertEquals(jobGraph.getJobID(), jobId);
+       }
+
+       @Test
+       public void testJobGraphWithNotFoundJar() {
+               final String jobClassName = fromJar("");
+
+               final ClassPathJobGraphRetriever classPathJobGraphRetriever = 
new ClassPathJobGraphRetriever(
+                       jobClassName,
+                       new JobID(),
+                       SavepointRestoreSettings.none(),
+                       PROGRAM_ARGUMENTS);
+
+               try {
+                       classPathJobGraphRetriever.retrieveJobGraph(new 
Configuration());
+                       fail("Did not throw expected FlinkException");
+               } catch (FlinkException expected) {
+                       Throwable rootCause = Throwables.getRootCause(expected);
 
 Review comment:
   Not necessarily because of guava, but your test relies on the order of 
exception. There is no reason why the test should fail if the root exception is 
something else.

----------------------------------------------------------------
This is an automated message from the Apache Git Service.
To respond to the message, please log on 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