Skip to content

Commit

Permalink
Fix for SparkContext stop behavior
Browse files Browse the repository at this point in the history
  • Loading branch information
rekhajoshm committed Jun 25, 2015
1 parent 58dba70 commit 9193a0c
Showing 1 changed file with 3 additions and 9 deletions.
12 changes: 3 additions & 9 deletions core/src/test/scala/org/apache/spark/SparkContextSuite.scala
Original file line number Diff line number Diff line change
Expand Up @@ -274,8 +274,7 @@ class SparkContextSuite extends SparkFunSuite with LocalSparkContext {
}
}

test("calling multiple sc.stop() must not throw uncaught exception(50) from sparkenv") {
var threwNoOrOnlyExceptedException = true
test("calling multiple sc.stop() must not throw any exception") {
try {
sc = new SparkContext(new SparkConf().setAppName("test").setMaster("local"))
val cnt = sc.parallelize(1 to 4).count()
Expand All @@ -284,13 +283,8 @@ class SparkContextSuite extends SparkFunSuite with LocalSparkContext {
// call stop second time
sc.stop()
} catch {
case e: ServerStateException =>
// assert(!e.getMessage.contains("Server is already stopped"))
threwNoOrOnlyExceptedException = false
case NonFatal(e) =>
threwNoOrOnlyExceptedException = true
} finally {
assert(threwNoOrOnlyExceptedException == true)
case e: Exception =>
fail("calling multiple sc.stop() must not have thrown any exception");
}
}
}

0 comments on commit 9193a0c

Please sign in to comment.