diff options
author | Shixiong Zhu <shixiong@databricks.com> | 2016-10-05 14:54:55 -0700 |
---|---|---|
committer | Shixiong Zhu <shixiong@databricks.com> | 2016-10-05 14:54:55 -0700 |
commit | 221b418b1c9db7b04c600b6300d18b034a4f444e (patch) | |
tree | 55fc1843fed6e1f0379a7a25cf9f0d89f0817cbd /core/src/test | |
parent | 9df54f5325c2942bb77008ff1810e2fb5f6d848b (diff) | |
download | spark-221b418b1c9db7b04c600b6300d18b034a4f444e.tar.gz spark-221b418b1c9db7b04c600b6300d18b034a4f444e.tar.bz2 spark-221b418b1c9db7b04c600b6300d18b034a4f444e.zip |
[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 <shixiong@databricks.com>
Closes #15350 from zsxwing/SPARK-17778.
Diffstat (limited to 'core/src/test')
-rw-r--r-- | core/src/test/scala/org/apache/spark/storage/BlockManagerSuite.scala | 5 |
1 files changed, 4 insertions, 1 deletions
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 1652fcdb96..705c355234 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) |