Skip to content

Commit 3fdb554

Browse files
committed
Remove setProperty call in TaskSchedulerImplSuite
1 parent bee20df commit 3fdb554

File tree

1 file changed

+4
-6
lines changed

1 file changed

+4
-6
lines changed

core/src/test/scala/org/apache/spark/scheduler/TaskSchedulerImplSuite.scala

Lines changed: 4 additions & 6 deletions
Original file line numberDiff line numberDiff line change
@@ -19,7 +19,6 @@ package org.apache.spark.scheduler
1919

2020
import java.util.Properties
2121

22-
import org.apache.spark.util.ResetSystemProperties
2322
import org.scalatest.FunSuite
2423

2524
import org.apache.spark._
@@ -110,8 +109,7 @@ class FakeTaskSetManager(
110109
}
111110
}
112111

113-
class TaskSchedulerImplSuite extends FunSuite with ResetSystemProperties with LocalSparkContext
114-
with Logging {
112+
class TaskSchedulerImplSuite extends FunSuite with LocalSparkContext with Logging {
115113

116114
def createDummyTaskSetManager(priority: Int, stage: Int, numTasks: Int, cs: TaskSchedulerImpl,
117115
taskSet: TaskSet): FakeTaskSetManager = {
@@ -164,12 +162,12 @@ class TaskSchedulerImplSuite extends FunSuite with ResetSystemProperties with Lo
164162
}
165163

166164
test("Fair Scheduler Test") {
167-
sc = new SparkContext("local", "TaskSchedulerImplSuite")
165+
val xmlPath = getClass.getClassLoader.getResource("fairscheduler.xml").getFile()
166+
val conf = new SparkConf().set("spark.scheduler.allocation.file", xmlPath)
167+
sc = new SparkContext("local", "TaskSchedulerImplSuite", conf)
168168
val taskScheduler = new TaskSchedulerImpl(sc)
169169
val taskSet = FakeTask.createTaskSet(1)
170170

171-
val xmlPath = getClass.getClassLoader.getResource("fairscheduler.xml").getFile()
172-
System.setProperty("spark.scheduler.allocation.file", xmlPath)
173171
val rootPool = new Pool("", SchedulingMode.FAIR, 0, 0)
174172
val schedulableBuilder = new FairSchedulableBuilder(rootPool, sc.conf)
175173
schedulableBuilder.buildPools()

0 commit comments

Comments
 (0)