@@ -63,6 +63,10 @@ class DefaultPackagedProgramRetrieverITCase {
63
63
ClasspathProviderExtension singleEntryClassClasspathProvider =
64
64
ClasspathProviderExtension .createWithSingleEntryClass ();
65
65
66
+ @ RegisterExtension
67
+ ClasspathProviderExtension symlinkClasspathProvider =
68
+ ClasspathProviderExtension .createWithSymlink ();
69
+
66
70
@ RegisterExtension
67
71
ClasspathProviderExtension multipleEntryClassesClasspathProvider =
68
72
ClasspathProviderExtension .createWithMultipleEntryClasses ();
@@ -522,6 +526,34 @@ void testRetrieveFromJarFileWithNonRootUserLib()
522
526
assertThat (actualClasspath ).isEqualTo (expectedClasspath );
523
527
}
524
528
529
+ @ Test
530
+ void testRetrieveFromJarFileWithSymlinkUserLib ()
531
+ throws IOException , FlinkException , ProgramInvocationException {
532
+ final File actualUsrLib = new File (symlinkClasspathProvider .getDirectory (), "usrlib" );
533
+ final PackagedProgramRetriever retrieverUnderTest =
534
+ DefaultPackagedProgramRetriever .create (
535
+ actualUsrLib ,
536
+ // the testJob jar is not on the user classpath
537
+ testJobEntryClassClasspathProvider .getJobJar (),
538
+ null ,
539
+ null ,
540
+ ClasspathProviderExtension .parametersForTestJob ("suffix" ),
541
+ new Configuration ());
542
+ final JobGraph jobGraph = retrieveJobGraph (retrieverUnderTest , new Configuration ());
543
+
544
+ assertThat (jobGraph .getUserJars ())
545
+ .contains (
546
+ new org .apache .flink .core .fs .Path (
547
+ testJobEntryClassClasspathProvider .getJobJar ().toURI ()));
548
+ final List <String > actualClasspath =
549
+ jobGraph .getClasspaths ().stream ().map (URL ::toString ).collect (Collectors .toList ());
550
+ final List <String > expectedClasspath =
551
+ extractRelativizedURLsForJarsFromDirectory (actualUsrLib );
552
+
553
+ assertThat (actualClasspath ).hasSize (2 );
554
+ assertThat (actualClasspath ).isEqualTo (expectedClasspath );
555
+ }
556
+
525
557
@ Test
526
558
void testRetrieveFromJarFileWithArtifacts ()
527
559
throws IOException , FlinkException , ProgramInvocationException {
@@ -684,6 +716,11 @@ private static List<String> extractRelativizedURLsForJarsFromDirectory(File dire
684
716
final List <String > relativizedURLs = new ArrayList <>();
685
717
final Path workingDirectory = FileUtils .getCurrentWorkingDirectory ();
686
718
for (File file : Preconditions .checkNotNull (directory .listFiles ())) {
719
+ if (file .isDirectory ()) {
720
+ relativizedURLs .addAll (extractRelativizedURLsForJarsFromDirectory (file ));
721
+ continue ;
722
+ }
723
+
687
724
if (!FileUtils .isJarFile (file .toPath ())) {
688
725
// any non-JARs are filtered by PackagedProgramRetrieverImpl
689
726
continue ;
0 commit comments