Repository: spark
Updated Branches:
  refs/heads/branch-1.6 f5c66d163 -> 340ca9e76


[SPARK-11290][STREAMING][TEST-MAVEN] Fix the test for maven build

Should not create SparkContext in the constructor of `TrackStateRDDSuite`. This 
is a follow up PR for #9256 to fix the test for maven build.

Author: Shixiong Zhu <shixi...@databricks.com>

Closes #9668 from zsxwing/hotfix.

(cherry picked from commit f0d3b58d91f43697397cdd7a7e7f38cbb7daaa31)
Signed-off-by: Tathagata Das <tathagata.das1...@gmail.com>


Project: http://git-wip-us.apache.org/repos/asf/spark/repo
Commit: http://git-wip-us.apache.org/repos/asf/spark/commit/340ca9e7
Tree: http://git-wip-us.apache.org/repos/asf/spark/tree/340ca9e7
Diff: http://git-wip-us.apache.org/repos/asf/spark/diff/340ca9e7

Branch: refs/heads/branch-1.6
Commit: 340ca9e7607e7a74698f6098249fe60517bdc911
Parents: f5c66d1
Author: Shixiong Zhu <shixi...@databricks.com>
Authored: Thu Nov 12 14:52:03 2015 -0800
Committer: Tathagata Das <tathagata.das1...@gmail.com>
Committed: Thu Nov 12 14:52:17 2015 -0800

----------------------------------------------------------------------
 .../apache/spark/streaming/rdd/TrackStateRDDSuite.scala | 12 +++++++++---
 1 file changed, 9 insertions(+), 3 deletions(-)
----------------------------------------------------------------------


http://git-wip-us.apache.org/repos/asf/spark/blob/340ca9e7/streaming/src/test/scala/org/apache/spark/streaming/rdd/TrackStateRDDSuite.scala
----------------------------------------------------------------------
diff --git 
a/streaming/src/test/scala/org/apache/spark/streaming/rdd/TrackStateRDDSuite.scala
 
b/streaming/src/test/scala/org/apache/spark/streaming/rdd/TrackStateRDDSuite.scala
index fc5f266..f396b76 100644
--- 
a/streaming/src/test/scala/org/apache/spark/streaming/rdd/TrackStateRDDSuite.scala
+++ 
b/streaming/src/test/scala/org/apache/spark/streaming/rdd/TrackStateRDDSuite.scala
@@ -28,11 +28,17 @@ import org.apache.spark.{HashPartitioner, SparkConf, 
SparkContext, SparkFunSuite
 
 class TrackStateRDDSuite extends SparkFunSuite with BeforeAndAfterAll {
 
-  private var sc = new SparkContext(
-    new SparkConf().setMaster("local").setAppName("TrackStateRDDSuite"))
+  private var sc: SparkContext = null
+
+  override def beforeAll(): Unit = {
+    sc = new SparkContext(
+      new SparkConf().setMaster("local").setAppName("TrackStateRDDSuite"))
+  }
 
   override def afterAll(): Unit = {
-    sc.stop()
+    if (sc != null) {
+      sc.stop()
+    }
   }
 
   test("creation from pair RDD") {


---------------------------------------------------------------------
To unsubscribe, e-mail: commits-unsubscr...@spark.apache.org
For additional commands, e-mail: commits-h...@spark.apache.org

Reply via email to