[ 
https://issues.apache.org/jira/browse/BEAM-5495?focusedWorklogId=361109&page=com.atlassian.jira.plugin.system.issuetabpanels:worklog-tabpanel#worklog-361109
 ]

ASF GitHub Bot logged work on BEAM-5495:
----------------------------------------

                Author: ASF GitHub Bot
            Created on: 17/Dec/19 21:02
            Start Date: 17/Dec/19 21:02
    Worklog Time Spent: 10m 
      Work Description: lukecwik commented on pull request #10268: [BEAM-5495] 
PipelineResources algorithm is not working in most environments
URL: https://github.com/apache/beam/pull/10268#discussion_r359021220
 
 

 ##########
 File path: 
runners/core-construction-java/src/test/java/org/apache/beam/runners/core/construction/resources/ClasspathScanningResourcesDetectorTest.java
 ##########
 @@ -0,0 +1,129 @@
+/*
+ * Licensed to the Apache Software Foundation (ASF) under one
+ * or more contributor license agreements.  See the NOTICE file
+ * distributed with this work for additional information
+ * regarding copyright ownership.  The ASF licenses this file
+ * to you under the Apache License, Version 2.0 (the
+ * "License"); you may not use this file except in compliance
+ * with the License.  You may obtain a copy of the License at
+ *
+ *     http://www.apache.org/licenses/LICENSE-2.0
+ *
+ * Unless required by applicable law or agreed to in writing, software
+ * distributed under the License is distributed on an "AS IS" BASIS,
+ * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
+ * See the License for the specific language governing permissions and
+ * limitations under the License.
+ */
+package org.apache.beam.runners.core.construction.resources;
+
+import static org.hamcrest.CoreMatchers.containsString;
+import static org.hamcrest.CoreMatchers.hasItem;
+import static org.hamcrest.CoreMatchers.hasItems;
+import static org.hamcrest.MatcherAssert.assertThat;
+import static org.hamcrest.Matchers.not;
+import static org.junit.Assert.assertFalse;
+
+import io.github.classgraph.ClassGraph;
+import java.io.File;
+import java.io.FileOutputStream;
+import java.io.IOException;
+import java.net.URL;
+import java.net.URLClassLoader;
+import java.util.List;
+import java.util.jar.JarOutputStream;
+import java.util.jar.Manifest;
+import java.util.stream.Collectors;
+import org.apache.beam.sdk.testing.RestoreSystemProperties;
+import org.junit.Before;
+import org.junit.Rule;
+import org.junit.Test;
+import org.junit.rules.TemporaryFolder;
+import org.mockito.Mockito;
+
+public class ClasspathScanningResourcesDetectorTest {
+
+  @Rule public transient TemporaryFolder tmpFolder = new TemporaryFolder();
+
+  @Rule public transient RestoreSystemProperties systemProperties = new 
RestoreSystemProperties();
+
+  private ClasspathScanningResourcesDetector detector;
+
+  private ClassLoader classLoader;
 
 Review comment:
   classLoader and detector are assigned but are not shared outside of the 
method body so please create them within the test instead as local variables. 
This would help with test readability.
 
----------------------------------------------------------------
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]


Issue Time Tracking
-------------------

    Worklog Id:     (was: 361109)

> PipelineResources algorithm is not working in most environments
> ---------------------------------------------------------------
>
>                 Key: BEAM-5495
>                 URL: https://issues.apache.org/jira/browse/BEAM-5495
>             Project: Beam
>          Issue Type: Bug
>          Components: runner-flink, runner-spark, sdk-java-core
>            Reporter: Romain Manni-Bucau
>            Assignee: Lukasz Gajowy
>            Priority: Major
>             Fix For: 2.19.0
>
>          Time Spent: 15h
>  Remaining Estimate: 0h
>
> Issue are:
> 1. it assumes the classloader is an URLClassLoader (not always true and java 
> >= 9 breaks that as well for the app loader)
> 2. it uses loader.getURLs() which leads to including the JRE itself in the 
> staged file
> Looks like this detect resource algorithm can't work and should be replaced 
> by a SPI rather than a built-in and not extensible algorithm. Another valid 
> alternative is to just drop that "guess" logic and force the user to set 
> staged files.



--
This message was sent by Atlassian Jira
(v8.3.4#803005)

Reply via email to