Github user vanzin commented on a diff in the pull request:

    https://github.com/apache/spark/pull/9812#discussion_r45419921
  
    --- Diff: 
repl/src/test/scala/org/apache/spark/repl/ExecutorClassLoaderSuite.scala ---
    @@ -99,6 +107,32 @@ class ExecutorClassLoaderSuite
         }
       }
     
    +  test("resource from parent") {
    +    val parentLoader = new URLClassLoader(urls2, null)
    +    val classLoader = new ExecutorClassLoader(new SparkConf(), url1, 
parentLoader, true)
    +    val resourceName: String = "fake-resource.txt"
    +    Option(classLoader.getResource(resourceName)) match {
    +      case Some(url) => {
    +        val fileReader = 
Source.fromInputStream(url.openStream()).bufferedReader()
    +        assert(fileReader.readLine().contains("resource"), "File doesn't 
contain 'resource'")
    +      }
    +      case None => fail(s"Resource $resourceName not found")
    +    }
    +  }
    +
    +  test("resources from parent") {
    +    val parentLoader = new URLClassLoader(urls2, null)
    +    val classLoader = new ExecutorClassLoader(new SparkConf(), url1, 
parentLoader, true)
    +    val resourceName: String = "fake-resource.txt"
    +    val resources: util.Enumeration[URL] = 
classLoader.getResources(resourceName)
    +    if (!resources.hasMoreElements) {
    --- End diff --
    
    `assert(resources.hasMoreElements)`


---
If your project is set up for it, you can reply to this email and have your
reply appear on GitHub as well. If your project does not have this feature
enabled and wishes so, or if the feature is enabled but not working, please
contact infrastructure at [email protected] or file a JIRA ticket
with INFRA.
---

---------------------------------------------------------------------
To unsubscribe, e-mail: [email protected]
For additional commands, e-mail: [email protected]

Reply via email to