Repository: spark Updated Branches: refs/heads/branch-2.0 a4f7df423 -> b8df2e53c
[SPARK-17778][TESTS] Mock SparkContext to reduce memory usage of BlockManagerSuite ## What changes were proposed in this pull request? Mock SparkContext to reduce memory usage of BlockManagerSuite ## How was this patch tested? Jenkins Author: Shixiong Zhu <shixi...@databricks.com> Closes #15350 from zsxwing/SPARK-17778. (cherry picked from commit 221b418b1c9db7b04c600b6300d18b034a4f444e) Signed-off-by: Shixiong Zhu <shixi...@databricks.com> Project: http://git-wip-us.apache.org/repos/asf/spark/repo Commit: http://git-wip-us.apache.org/repos/asf/spark/commit/b8df2e53 Tree: http://git-wip-us.apache.org/repos/asf/spark/tree/b8df2e53 Diff: http://git-wip-us.apache.org/repos/asf/spark/diff/b8df2e53 Branch: refs/heads/branch-2.0 Commit: b8df2e53c38a30f51c710543c81279a59a9ab4fc Parents: a4f7df4 Author: Shixiong Zhu <shixi...@databricks.com> Authored: Wed Oct 5 14:54:55 2016 -0700 Committer: Shixiong Zhu <shixi...@databricks.com> Committed: Wed Oct 5 14:55:29 2016 -0700 ---------------------------------------------------------------------- .../test/scala/org/apache/spark/storage/BlockManagerSuite.scala | 5 ++++- 1 file changed, 4 insertions(+), 1 deletion(-) ---------------------------------------------------------------------- http://git-wip-us.apache.org/repos/asf/spark/blob/b8df2e53/core/src/test/scala/org/apache/spark/storage/BlockManagerSuite.scala ---------------------------------------------------------------------- diff --git a/core/src/test/scala/org/apache/spark/storage/BlockManagerSuite.scala b/core/src/test/scala/org/apache/spark/storage/BlockManagerSuite.scala index e93eee2..1b3197a 100644 --- a/core/src/test/scala/org/apache/spark/storage/BlockManagerSuite.scala +++ b/core/src/test/scala/org/apache/spark/storage/BlockManagerSuite.scala @@ -107,7 +107,10 @@ class BlockManagerSuite extends SparkFunSuite with Matchers with BeforeAndAfterE rpcEnv = RpcEnv.create("test", "localhost", 0, conf, securityMgr) conf.set("spark.driver.port", rpcEnv.address.port.toString) - sc = new SparkContext("local", "test", conf) + // Mock SparkContext to reduce the memory usage of tests. It's fine since the only reason we + // need to create a SparkContext is to initialize LiveListenerBus. + sc = mock(classOf[SparkContext]) + when(sc.conf).thenReturn(conf) master = new BlockManagerMaster(rpcEnv.setupEndpoint("blockmanager", new BlockManagerMasterEndpoint(rpcEnv, true, conf, new LiveListenerBus(sc))), conf, true) --------------------------------------------------------------------- To unsubscribe, e-mail: commits-unsubscr...@spark.apache.org For additional commands, e-mail: commits-h...@spark.apache.org