Skip to content

Commit

Permalink
Fix tests
Browse files Browse the repository at this point in the history
It seems that the tests assume we can keep opening UI ports. Our
existing default for spark.ports.maxRetries does not tolerate this,
however, so the test process throws an exception and returns exit
code 1.
  • Loading branch information
andrewor14 committed Aug 6, 2014
1 parent 523c30e commit 7da0493
Show file tree
Hide file tree
Showing 2 changed files with 10 additions and 5 deletions.
14 changes: 9 additions & 5 deletions core/src/main/scala/org/apache/spark/util/Utils.scala
Original file line number Diff line number Diff line change
Expand Up @@ -1335,11 +1335,15 @@ private[spark] object Utils extends Logging {
* Default number of retries in binding to a port.
*/
val portMaxRetries: Int = {
// SparkEnv may be null during tests
Option(SparkEnv.get)
.flatMap(_.conf.getOption("spark.ports.maxRetries"))
.map(_.toInt)
.getOrElse(16)
if (sys.props.contains("spark.testing")) {
// Set a higher number of retries for tests...
sys.props.get("spark.ports.maxRetries").map(_.toInt).getOrElse(100)
} else {
Option(SparkEnv.get)
.flatMap(_.conf.getOption("spark.ports.maxRetries"))
.map(_.toInt)
.getOrElse(16)
}
}

/**
Expand Down
1 change: 1 addition & 0 deletions project/SparkBuild.scala
Original file line number Diff line number Diff line change
Expand Up @@ -330,6 +330,7 @@ object TestSettings {
fork := true,
javaOptions in Test += "-Dspark.test.home=" + sparkHome,
javaOptions in Test += "-Dspark.testing=1",
javaOptions in Test += "-Dspark.ports.maxRetries=100",
javaOptions in Test += "-Dsun.io.serialization.extendedDebugInfo=true",
javaOptions in Test ++= System.getProperties.filter(_._1 startsWith "spark")
.map { case (k,v) => s"-D$k=$v" }.toSeq,
Expand Down

0 comments on commit 7da0493

Please sign in to comment.