Skip to content

Commit 9193a0c

Browse files
committed
Fix for SparkContext stop behavior
1 parent 58dba70 commit 9193a0c

File tree

1 file changed

+3
-9
lines changed

1 file changed

+3
-9
lines changed

core/src/test/scala/org/apache/spark/SparkContextSuite.scala

Lines changed: 3 additions & 9 deletions
Original file line numberDiff line numberDiff line change
@@ -274,8 +274,7 @@ class SparkContextSuite extends SparkFunSuite with LocalSparkContext {
274274
}
275275
}
276276

277-
test("calling multiple sc.stop() must not throw uncaught exception(50) from sparkenv") {
278-
var threwNoOrOnlyExceptedException = true
277+
test("calling multiple sc.stop() must not throw any exception") {
279278
try {
280279
sc = new SparkContext(new SparkConf().setAppName("test").setMaster("local"))
281280
val cnt = sc.parallelize(1 to 4).count()
@@ -284,13 +283,8 @@ class SparkContextSuite extends SparkFunSuite with LocalSparkContext {
284283
// call stop second time
285284
sc.stop()
286285
} catch {
287-
case e: ServerStateException =>
288-
// assert(!e.getMessage.contains("Server is already stopped"))
289-
threwNoOrOnlyExceptedException = false
290-
case NonFatal(e) =>
291-
threwNoOrOnlyExceptedException = true
292-
} finally {
293-
assert(threwNoOrOnlyExceptedException == true)
286+
case e: Exception =>
287+
fail("calling multiple sc.stop() must not have thrown any exception");
294288
}
295289
}
296290
}

0 commit comments

Comments
 (0)