Skip to content

Commit 9ccab09

Browse files
committed
Address review comments
1 parent e6494dc commit 9ccab09

File tree

1 file changed

+7
-4
lines changed

1 file changed

+7
-4
lines changed

core/src/test/scala/org/apache/spark/scheduler/mesos/MesosSchedulerBackendSuite.scala

Lines changed: 7 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -29,6 +29,7 @@ import org.easymock.{Capture, EasyMock}
2929
import java.nio.ByteBuffer
3030
import java.util.Collections
3131
import java.util
32+
import scala.collection.mutable
3233

3334
class MesosSchedulerBackendSuite extends FunSuite with LocalSparkContext with EasyMockSugar {
3435
test("mesos resource offer is launching tasks") {
@@ -52,10 +53,12 @@ class MesosSchedulerBackendSuite extends FunSuite with LocalSparkContext with Ea
5253
offers.add(createOffer(1, 101, 1))
5354
offers.add(createOffer(1, 99, 1))
5455

55-
val conf = new SparkConf
56-
conf.set("spark.executor.memory", "100m")
57-
conf.set("spark.home", "/path")
58-
val sc = new SparkContext("local-cluster[2 , 1 , 512]", "test", conf)
56+
val sc = EasyMock.createMock(classOf[SparkContext])
57+
EasyMock.expect(sc.executorMemory).andReturn(100).anyTimes()
58+
EasyMock.expect(sc.getSparkHome()).andReturn(Option("/path")).anyTimes()
59+
EasyMock.expect(sc.executorEnvs).andReturn(new mutable.HashMap).anyTimes()
60+
EasyMock.expect(sc.conf).andReturn(new SparkConf).anyTimes()
61+
EasyMock.replay(sc)
5962
val backend = new MesosSchedulerBackend(taskScheduler, sc, "master")
6063
val workerOffers = Seq(backend.toWorkerOffer(offers.get(0)))
6164
val taskDesc = new TaskDescription(1L, "s1", "n1", 0, ByteBuffer.wrap(new Array[Byte](0)))

0 commit comments

Comments
 (0)