You are viewing a plain text version of this content. The canonical link for it is here.
Posted to commits@spark.apache.org by js...@apache.org on 2018/03/26 06:01:11 UTC
spark git commit: [SPARK-23787][TESTS] Fix file download test in
SparkSubmitSuite for Hadoop 2.9.
Repository: spark
Updated Branches:
refs/heads/master 087fb3142 -> eb48edf9c
[SPARK-23787][TESTS] Fix file download test in SparkSubmitSuite for Hadoop 2.9.
This particular test assumed that Hadoop libraries did not support
http as a file system. Hadoop 2.9 does, so the test failed. The test
now forces a non-existent implementation for the http fs, which
forces the expected error.
There were also a couple of other issues in the same test: SparkSubmit
arguments in the wrong order, and the wrong check later when asserting,
which was being masked by the previous issues.
Author: Marcelo Vanzin <va...@cloudera.com>
Closes #20895 from vanzin/SPARK-23787.
Project: http://git-wip-us.apache.org/repos/asf/spark/repo
Commit: http://git-wip-us.apache.org/repos/asf/spark/commit/eb48edf9
Tree: http://git-wip-us.apache.org/repos/asf/spark/tree/eb48edf9
Diff: http://git-wip-us.apache.org/repos/asf/spark/diff/eb48edf9
Branch: refs/heads/master
Commit: eb48edf9ca4f4b42c63f145718696472cb6a31ba
Parents: 087fb31
Author: Marcelo Vanzin <va...@cloudera.com>
Authored: Mon Mar 26 14:01:04 2018 +0800
Committer: jerryshao <ss...@hortonworks.com>
Committed: Mon Mar 26 14:01:04 2018 +0800
----------------------------------------------------------------------
.../apache/spark/deploy/SparkSubmitSuite.scala | 36 +++++++++++---------
1 file changed, 19 insertions(+), 17 deletions(-)
----------------------------------------------------------------------
http://git-wip-us.apache.org/repos/asf/spark/blob/eb48edf9/core/src/test/scala/org/apache/spark/deploy/SparkSubmitSuite.scala
----------------------------------------------------------------------
diff --git a/core/src/test/scala/org/apache/spark/deploy/SparkSubmitSuite.scala b/core/src/test/scala/org/apache/spark/deploy/SparkSubmitSuite.scala
index 2d0c192..d86ef90 100644
--- a/core/src/test/scala/org/apache/spark/deploy/SparkSubmitSuite.scala
+++ b/core/src/test/scala/org/apache/spark/deploy/SparkSubmitSuite.scala
@@ -959,25 +959,28 @@ class SparkSubmitSuite
}
test("download remote resource if it is not supported by yarn service") {
- testRemoteResources(isHttpSchemeBlacklisted = false, supportMockHttpFs = false)
+ testRemoteResources(enableHttpFs = false, blacklistHttpFs = false)
}
test("avoid downloading remote resource if it is supported by yarn service") {
- testRemoteResources(isHttpSchemeBlacklisted = false, supportMockHttpFs = true)
+ testRemoteResources(enableHttpFs = true, blacklistHttpFs = false)
}
test("force download from blacklisted schemes") {
- testRemoteResources(isHttpSchemeBlacklisted = true, supportMockHttpFs = true)
+ testRemoteResources(enableHttpFs = true, blacklistHttpFs = true)
}
- private def testRemoteResources(isHttpSchemeBlacklisted: Boolean,
- supportMockHttpFs: Boolean): Unit = {
+ private def testRemoteResources(
+ enableHttpFs: Boolean,
+ blacklistHttpFs: Boolean): Unit = {
val hadoopConf = new Configuration()
updateConfWithFakeS3Fs(hadoopConf)
- if (supportMockHttpFs) {
+ if (enableHttpFs) {
hadoopConf.set("fs.http.impl", classOf[TestFileSystem].getCanonicalName)
- hadoopConf.set("fs.http.impl.disable.cache", "true")
+ } else {
+ hadoopConf.set("fs.http.impl", getClass().getName() + ".DoesNotExist")
}
+ hadoopConf.set("fs.http.impl.disable.cache", "true")
val tmpDir = Utils.createTempDir()
val mainResource = File.createTempFile("tmpPy", ".py", tmpDir)
@@ -986,20 +989,19 @@ class SparkSubmitSuite
val tmpHttpJar = TestUtils.createJarWithFiles(Map("test.resource" -> "USER"), tmpDir)
val tmpHttpJarPath = s"http://${new File(tmpHttpJar.toURI).getAbsolutePath}"
+ val forceDownloadArgs = if (blacklistHttpFs) {
+ Seq("--conf", "spark.yarn.dist.forceDownloadSchemes=http")
+ } else {
+ Nil
+ }
+
val args = Seq(
"--class", UserClasspathFirstTest.getClass.getName.stripPrefix("$"),
"--name", "testApp",
"--master", "yarn",
"--deploy-mode", "client",
- "--jars", s"$tmpS3JarPath,$tmpHttpJarPath",
- s"s3a://$mainResource"
- ) ++ (
- if (isHttpSchemeBlacklisted) {
- Seq("--conf", "spark.yarn.dist.forceDownloadSchemes=http,https")
- } else {
- Nil
- }
- )
+ "--jars", s"$tmpS3JarPath,$tmpHttpJarPath"
+ ) ++ forceDownloadArgs ++ Seq(s"s3a://$mainResource")
val appArgs = new SparkSubmitArguments(args)
val (_, _, conf, _) = SparkSubmit.prepareSubmitEnvironment(appArgs, Some(hadoopConf))
@@ -1009,7 +1011,7 @@ class SparkSubmitSuite
// The URI of remote S3 resource should still be remote.
assert(jars.contains(tmpS3JarPath))
- if (supportMockHttpFs) {
+ if (enableHttpFs && !blacklistHttpFs) {
// If Http FS is supported by yarn service, the URI of remote http resource should
// still be remote.
assert(jars.contains(tmpHttpJarPath))
---------------------------------------------------------------------
To unsubscribe, e-mail: commits-unsubscribe@spark.apache.org
For additional commands, e-mail: commits-help@spark.apache.org