From 9193a0cf315f07f149846cac973d245f832797e4 Mon Sep 17 00:00:00 2001 From: Joshi Date: Thu, 25 Jun 2015 11:59:39 -0700 Subject: [PATCH] Fix for SparkContext stop behavior --- .../scala/org/apache/spark/SparkContextSuite.scala | 12 +++--------- 1 file changed, 3 insertions(+), 9 deletions(-) diff --git a/core/src/test/scala/org/apache/spark/SparkContextSuite.scala b/core/src/test/scala/org/apache/spark/SparkContextSuite.scala index 765356c715a60..24a9334cb5133 100644 --- a/core/src/test/scala/org/apache/spark/SparkContextSuite.scala +++ b/core/src/test/scala/org/apache/spark/SparkContextSuite.scala @@ -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() @@ -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"); } } }