Skip to content

Commit 27456b9

Browse files
author
Marcelo Vanzin
committed
More exception safety.
1 parent a0b0881 commit 27456b9

File tree

1 file changed

+3
-2
lines changed

1 file changed

+3
-2
lines changed

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

Lines changed: 3 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -49,18 +49,19 @@ class ExecutorAllocationManagerSuite extends FunSuite with LocalSparkContext wit
4949
.set("spark.dynamicAllocation.enabled", "true")
5050
.set("spark.dynamicAllocation.testing", "true")
5151
val sc0 = new SparkContext(conf)
52+
contexts += sc0
5253
assert(sc0.executorAllocationManager.isDefined)
5354
sc0.stop()
5455

5556
// Min < 0
5657
val conf1 = conf.clone().set("spark.dynamicAllocation.minExecutors", "-1")
57-
intercept[SparkException] { new SparkContext(conf1) }
58+
intercept[SparkException] { contexts += new SparkContext(conf1) }
5859
SparkEnv.get.stop()
5960
SparkContext.clearActiveContext()
6061

6162
// Max < 0
6263
val conf2 = conf.clone().set("spark.dynamicAllocation.maxExecutors", "-1")
63-
intercept[SparkException] { new SparkContext(conf2) }
64+
intercept[SparkException] { contexts += new SparkContext(conf2) }
6465
SparkEnv.get.stop()
6566
SparkContext.clearActiveContext()
6667

0 commit comments

Comments
 (0)