[ 
https://issues.apache.org/jira/browse/FLINK-35512?page=com.atlassian.jira.plugin.system.issuetabpanels:comment-tabpanel&focusedCommentId=17852243#comment-17852243
 ] 

Rob Young commented on FLINK-35512:
-----------------------------------

The additional artifact looks arbitrary from the ArtifactFetchManager's point 
of view, so instead of depending on output of the build, maybe we should use a 
file controlled by the test like:
{code:java}
-    private File getFlinkClientsJar() throws IOException {
-        return TestingUtils.getFileFromTargetDir(
-                ArtifactFetchManager.class,
-                p ->
-                        org.apache.flink.util.FileUtils.isJarFile(p)
-                                && 
p.toFile().getName().startsWith("flink-clients")
-                                && 
!p.toFile().getName().contains("test-utils"));
+    private File createArbitraryArtifact() throws IOException {
+        Path tempFile = Files.createTempFile(tempDir, "arbitrary", ".jar");
+        Files.write(tempFile, 
UUID.randomUUID().toString().getBytes(StandardCharsets.UTF_8));
+        return tempFile.toFile();
     } {code}
usages of `File sourceFile = TestingUtils.getClassFile(getClass());` could also 
be replaced with this so all test inputs are generated by the test

 

> ArtifactFetchManagerTest unit tests fail
> ----------------------------------------
>
>                 Key: FLINK-35512
>                 URL: https://issues.apache.org/jira/browse/FLINK-35512
>             Project: Flink
>          Issue Type: Technical Debt
>    Affects Versions: 1.19.1
>            Reporter: Hong Liang Teoh
>            Priority: Major
>             Fix For: 1.19.1
>
>
> The below three tests from *ArtifactFetchManagerTest* seem to fail 
> consistently:
>  * ArtifactFetchManagerTest.testFileSystemFetchWithAdditionalUri
>  * ArtifactFetchManagerTest.testMixedArtifactFetch
>  * ArtifactFetchManagerTest.testHttpFetch
> The error printed is
> {code:java}
> java.lang.AssertionError:
> Expecting actual not to be empty
>     at 
> org.apache.flink.client.program.artifact.ArtifactFetchManagerTest.getFlinkClientsJar(ArtifactFetchManagerTest.java:248)
>     at 
> org.apache.flink.client.program.artifact.ArtifactFetchManagerTest.testMixedArtifactFetch(ArtifactFetchManagerTest.java:146)
>     at java.lang.reflect.Method.invoke(Method.java:498)
>     at java.util.concurrent.RecursiveAction.exec(RecursiveAction.java:189)
>     at java.util.concurrent.ForkJoinTask.doExec(ForkJoinTask.java:289)
>     at 
> java.util.concurrent.ForkJoinPool$WorkQueue.runTask(ForkJoinPool.java:1056)
>     at java.util.concurrent.ForkJoinPool.runWorker(ForkJoinPool.java:1692)
>     at 
> java.util.concurrent.ForkJoinWorkerThread.run(ForkJoinWorkerThread.java:175) 
> {code}
>  



--
This message was sent by Atlassian Jira
(v8.20.10#820010)

Reply via email to