Skip to content

Commit 2ce5760

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

File tree

1 file changed

+2
-4
lines changed

1 file changed

+2
-4
lines changed

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

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

277277
test("calling multiple sc.stop() must not throw any exception") {
278-
try {
278+
noException should be thrownBy {
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);
288285
}
289286
}
287+
290288
}

0 commit comments

Comments
 (0)