Skip to content

Commit c97839a

Browse files
committed
Fix for SparkContext stop behavior
1 parent 1aff39c commit c97839a

File tree

1 file changed

+4
-1
lines changed

1 file changed

+4
-1
lines changed

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

Lines changed: 4 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -275,13 +275,16 @@ class SparkContextSuite extends SparkFunSuite with LocalSparkContext {
275275
}
276276

277277
test("calling multiple sc.stop() must not throw any exception") {
278-
noException should be thrownBy {
278+
try {
279279
sc = new SparkContext(new SparkConf().setAppName("test").setMaster("local"))
280280
val cnt = sc.parallelize(1 to 4).count()
281281
sc.cancelAllJobs()
282282
sc.stop()
283283
// call stop second time
284284
sc.stop()
285+
} catch {
286+
case e: Exception =>
287+
fail("calling multiple sc.stop() must not have thrown any exception", e);
285288
}
286289
}
287290
}

0 commit comments

Comments
 (0)