Skip to content

Commit 9f911c9

Browse files
committed
[SPARK-1010] Clean up uses of System.setProperty in unit tests
Several of our tests call System.setProperty (or test code which implicitly sets system properties) and don't always reset/clear the modified properties, which can create ordering dependencies between tests and cause hard-to-diagnose failures. This patch removes most uses of System.setProperty from our tests, since in most cases we can use SparkConf to set these configurations (there are a few exceptions, including the tests of SparkConf itself). For the cases where we continue to use System.setProperty, this patch introduces a `ResetSystemProperties` ScalaTest mixin class which snapshots the system properties before individual tests and to automatically restores them on test completion / failure. See the block comment at the top of the ResetSystemProperties class for more details. Author: Josh Rosen <[email protected]> Closes #3739 from JoshRosen/cleanup-system-properties-in-tests and squashes the following commits: 0236d66 [Josh Rosen] Replace setProperty uses in two example programs / tools 3888fe3 [Josh Rosen] Remove setProperty use in LocalJavaStreamingContext 4f4031d [Josh Rosen] Add note on why SparkSubmitSuite needs ResetSystemProperties 4742a5b [Josh Rosen] Clarify ResetSystemProperties trait inheritance ordering. 0eaf0b6 [Josh Rosen] Remove setProperty call in TaskResultGetterSuite. 7a3d224 [Josh Rosen] Fix trait ordering 3fdb554 [Josh Rosen] Remove setProperty call in TaskSchedulerImplSuite bee20df [Josh Rosen] Remove setProperty calls in SparkContextSchedulerCreationSuite 655587c [Josh Rosen] Remove setProperty calls in JobCancellationSuite 3f2f955 [Josh Rosen] Remove System.setProperty calls in DistributedSuite cfe9cce [Josh Rosen] Remove use of system properties in SparkContextSuite 8783ab0 [Josh Rosen] Remove TestUtils.setSystemProperty, since it is subsumed by the ResetSystemProperties trait. 633a84a [Josh Rosen] Remove use of system properties in FileServerSuite 25bfce2 [Josh Rosen] Use ResetSystemProperties in UtilsSuite 1d1aa5a [Josh Rosen] Use ResetSystemProperties in SizeEstimatorSuite dd9492b [Josh Rosen] Use ResetSystemProperties in AkkaUtilsSuite b0daff2 [Josh Rosen] Use ResetSystemProperties in BlockManagerSuite e9ded62 [Josh Rosen] Use ResetSystemProperties in TaskSchedulerImplSuite 5b3cb54 [Josh Rosen] Use ResetSystemProperties in SparkListenerSuite 0995c4b [Josh Rosen] Use ResetSystemProperties in SparkContextSchedulerCreationSuite c83ded8 [Josh Rosen] Use ResetSystemProperties in SparkConfSuite 51aa870 [Josh Rosen] Use withSystemProperty in ShuffleSuite 60a63a1 [Josh Rosen] Use ResetSystemProperties in JobCancellationSuite 14a92e4 [Josh Rosen] Use withSystemProperty in FileServerSuite 628f46c [Josh Rosen] Use ResetSystemProperties in DistributedSuite 9e3e0dd [Josh Rosen] Add ResetSystemProperties test fixture mixin; use it in SparkSubmitSuite. 4dcea38 [Josh Rosen] Move withSystemProperty to TestUtils class. (cherry picked from commit 352ed6b) Signed-off-by: Josh Rosen <[email protected]> Conflicts: core/src/test/scala/org/apache/spark/ShuffleSuite.scala core/src/test/scala/org/apache/spark/SparkConfSuite.scala core/src/test/scala/org/apache/spark/SparkContextSchedulerCreationSuite.scala core/src/test/scala/org/apache/spark/SparkContextSuite.scala core/src/test/scala/org/apache/spark/storage/BlockManagerSuite.scala core/src/test/scala/org/apache/spark/util/UtilsSuite.scala external/flume/src/test/java/org/apache/spark/streaming/LocalJavaStreamingContext.java external/mqtt/src/test/java/org/apache/spark/streaming/LocalJavaStreamingContext.java external/twitter/src/test/java/org/apache/spark/streaming/LocalJavaStreamingContext.java external/zeromq/src/test/java/org/apache/spark/streaming/LocalJavaStreamingContext.java tools/src/main/scala/org/apache/spark/tools/StoragePerfTester.scala Conflicts: core/src/test/scala/org/apache/spark/DistributedSuite.scala core/src/test/scala/org/apache/spark/SparkContextSchedulerCreationSuite.scala core/src/test/scala/org/apache/spark/deploy/SparkSubmitSuite.scala core/src/test/scala/org/apache/spark/scheduler/SparkListenerSuite.scala core/src/test/scala/org/apache/spark/storage/BlockManagerSuite.scala streaming/src/test/java/org/apache/spark/streaming/LocalJavaStreamingContext.java
1 parent f47e162 commit 9f911c9

File tree

18 files changed

+170
-177
lines changed

18 files changed

+170
-177
lines changed

core/src/test/scala/org/apache/spark/AkkaUtilsSuite.scala

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -22,13 +22,13 @@ import org.scalatest.FunSuite
2222
import akka.actor._
2323
import org.apache.spark.scheduler.MapStatus
2424
import org.apache.spark.storage.BlockManagerId
25-
import org.apache.spark.util.AkkaUtils
25+
import org.apache.spark.util.{ResetSystemProperties, AkkaUtils}
2626
import scala.concurrent.Await
2727

2828
/**
2929
* Test the AkkaUtils with various security settings.
3030
*/
31-
class AkkaUtilsSuite extends FunSuite with LocalSparkContext {
31+
class AkkaUtilsSuite extends FunSuite with LocalSparkContext with ResetSystemProperties {
3232

3333
test("remote fetch security bad password") {
3434
val conf = new SparkConf

core/src/test/scala/org/apache/spark/DistributedSuite.scala

Lines changed: 5 additions & 16 deletions
Original file line numberDiff line numberDiff line change
@@ -17,7 +17,6 @@
1717

1818
package org.apache.spark
1919

20-
import org.scalatest.BeforeAndAfter
2120
import org.scalatest.FunSuite
2221
import org.scalatest.concurrent.Timeouts._
2322
import org.scalatest.matchers.ShouldMatchers
@@ -31,16 +30,10 @@ class NotSerializableClass
3130
class NotSerializableExn(val notSer: NotSerializableClass) extends Throwable() {}
3231

3332

34-
class DistributedSuite extends FunSuite with ShouldMatchers with BeforeAndAfter
35-
with LocalSparkContext {
33+
class DistributedSuite extends FunSuite with ShouldMatchers with LocalSparkContext {
3634

3735
val clusterUrl = "local-cluster[2,1,512]"
3836

39-
after {
40-
System.clearProperty("spark.reducer.maxMbInFlight")
41-
System.clearProperty("spark.storage.memoryFraction")
42-
}
43-
4437
test("task throws not serializable exception") {
4538
// Ensures that executors do not crash when an exn is not serializable. If executors crash,
4639
// this test will hang. Correct behavior is that executors don't crash but fail tasks
@@ -86,15 +79,14 @@ class DistributedSuite extends FunSuite with ShouldMatchers with BeforeAndAfter
8679
}
8780

8881
test("groupByKey where map output sizes exceed maxMbInFlight") {
89-
System.setProperty("spark.reducer.maxMbInFlight", "1")
90-
sc = new SparkContext(clusterUrl, "test")
82+
val conf = new SparkConf().set("spark.reducer.maxMbInFlight", "1")
83+
sc = new SparkContext(clusterUrl, "test", conf)
9184
// This data should be around 20 MB, so even with 4 mappers and 2 reducers, each map output
9285
// file should be about 2.5 MB
9386
val pairs = sc.parallelize(1 to 2000, 4).map(x => (x % 16, new Array[Byte](10000)))
9487
val groups = pairs.groupByKey(2).map(x => (x._1, x._2.size)).collect()
9588
assert(groups.length === 16)
9689
assert(groups.map(_._2).sum === 2000)
97-
// Note that spark.reducer.maxMbInFlight will be cleared in the test suite's after{} block
9890
}
9991

10092
test("accumulators") {
@@ -211,28 +203,25 @@ class DistributedSuite extends FunSuite with ShouldMatchers with BeforeAndAfter
211203
}
212204

213205
test("compute without caching when no partitions fit in memory") {
214-
System.setProperty("spark.storage.memoryFraction", "0.0001")
215206
sc = new SparkContext(clusterUrl, "test")
216207
// data will be 4 million * 4 bytes = 16 MB in size, but our memoryFraction set the cache
217208
// to only 50 KB (0.0001 of 512 MB), so no partitions should fit in memory
218209
val data = sc.parallelize(1 to 4000000, 2).persist(StorageLevel.MEMORY_ONLY_SER)
219210
assert(data.count() === 4000000)
220211
assert(data.count() === 4000000)
221212
assert(data.count() === 4000000)
222-
System.clearProperty("spark.storage.memoryFraction")
223213
}
224214

225215
test("compute when only some partitions fit in memory") {
226-
System.setProperty("spark.storage.memoryFraction", "0.01")
227-
sc = new SparkContext(clusterUrl, "test")
216+
val conf = new SparkConf().set("spark.storage.memoryFraction", "0.01")
217+
sc = new SparkContext(clusterUrl, "test", conf)
228218
// data will be 4 million * 4 bytes = 16 MB in size, but our memoryFraction set the cache
229219
// to only 5 MB (0.01 of 512 MB), so not all of it will fit in memory; we use 20 partitions
230220
// to make sure that *some* of them do fit though
231221
val data = sc.parallelize(1 to 4000000, 20).persist(StorageLevel.MEMORY_ONLY_SER)
232222
assert(data.count() === 4000000)
233223
assert(data.count() === 4000000)
234224
assert(data.count() === 4000000)
235-
System.clearProperty("spark.storage.memoryFraction")
236225
}
237226

238227
test("passing environment variables to cluster") {

core/src/test/scala/org/apache/spark/FileServerSuite.scala

Lines changed: 8 additions & 8 deletions
Original file line numberDiff line numberDiff line change
@@ -32,10 +32,11 @@ class FileServerSuite extends FunSuite with LocalSparkContext {
3232
@transient var tmpFile: File = _
3333
@transient var tmpJarUrl: String = _
3434

35+
def newConf: SparkConf = new SparkConf(loadDefaults = false).set("spark.authenticate", "false")
36+
3537
override def beforeEach() {
3638
super.beforeEach()
3739
resetSparkContext()
38-
System.setProperty("spark.authenticate", "false")
3940
}
4041

4142
override def beforeAll() {
@@ -54,7 +55,6 @@ class FileServerSuite extends FunSuite with LocalSparkContext {
5455
val jarFile = new File(testTempDir, "test.jar")
5556
val jarStream = new FileOutputStream(jarFile)
5657
val jar = new JarOutputStream(jarStream, new java.util.jar.Manifest())
57-
System.setProperty("spark.authenticate", "false")
5858

5959
val jarEntry = new JarEntry(textFile.getName)
6060
jar.putNextEntry(jarEntry)
@@ -81,7 +81,7 @@ class FileServerSuite extends FunSuite with LocalSparkContext {
8181
}
8282

8383
test("Distributing files locally") {
84-
sc = new SparkContext("local[4]", "test")
84+
sc = new SparkContext("local[4]", "test", newConf)
8585
sc.addFile(tmpFile.toString)
8686
val testData = Array((1,1), (1,1), (2,1), (3,5), (2,2), (3,0))
8787
val result = sc.parallelize(testData).reduceByKey {
@@ -115,7 +115,7 @@ class FileServerSuite extends FunSuite with LocalSparkContext {
115115

116116
test("Distributing files locally using URL as input") {
117117
// addFile("file:///....")
118-
sc = new SparkContext("local[4]", "test")
118+
sc = new SparkContext("local[4]", "test", newConf)
119119
sc.addFile(new File(tmpFile.toString).toURI.toString)
120120
val testData = Array((1,1), (1,1), (2,1), (3,5), (2,2), (3,0))
121121
val result = sc.parallelize(testData).reduceByKey {
@@ -129,7 +129,7 @@ class FileServerSuite extends FunSuite with LocalSparkContext {
129129
}
130130

131131
test ("Dynamically adding JARS locally") {
132-
sc = new SparkContext("local[4]", "test")
132+
sc = new SparkContext("local[4]", "test", newConf)
133133
sc.addJar(tmpJarUrl)
134134
val testData = Array((1, 1))
135135
sc.parallelize(testData).foreach { x =>
@@ -140,7 +140,7 @@ class FileServerSuite extends FunSuite with LocalSparkContext {
140140
}
141141

142142
test("Distributing files on a standalone cluster") {
143-
sc = new SparkContext("local-cluster[1,1,512]", "test")
143+
sc = new SparkContext("local-cluster[1,1,512]", "test", newConf)
144144
sc.addFile(tmpFile.toString)
145145
val testData = Array((1,1), (1,1), (2,1), (3,5), (2,2), (3,0))
146146
val result = sc.parallelize(testData).reduceByKey {
@@ -154,7 +154,7 @@ class FileServerSuite extends FunSuite with LocalSparkContext {
154154
}
155155

156156
test ("Dynamically adding JARS on a standalone cluster") {
157-
sc = new SparkContext("local-cluster[1,1,512]", "test")
157+
sc = new SparkContext("local-cluster[1,1,512]", "test", newConf)
158158
sc.addJar(tmpJarUrl)
159159
val testData = Array((1,1))
160160
sc.parallelize(testData).foreach { x =>
@@ -165,7 +165,7 @@ class FileServerSuite extends FunSuite with LocalSparkContext {
165165
}
166166

167167
test ("Dynamically adding JARS on a standalone cluster using local: URL") {
168-
sc = new SparkContext("local-cluster[1,1,512]", "test")
168+
sc = new SparkContext("local-cluster[1,1,512]", "test", newConf)
169169
sc.addJar(tmpJarUrl.replace("file", "local"))
170170
val testData = Array((1,1))
171171
sc.parallelize(testData).foreach { x =>

core/src/test/scala/org/apache/spark/JobCancellationSuite.scala

Lines changed: 10 additions & 11 deletions
Original file line numberDiff line numberDiff line change
@@ -41,43 +41,42 @@ class JobCancellationSuite extends FunSuite with ShouldMatchers with BeforeAndAf
4141
override def afterEach() {
4242
super.afterEach()
4343
resetSparkContext()
44-
System.clearProperty("spark.scheduler.mode")
4544
}
4645

4746
test("local mode, FIFO scheduler") {
48-
System.setProperty("spark.scheduler.mode", "FIFO")
49-
sc = new SparkContext("local[2]", "test")
47+
val conf = new SparkConf().set("spark.scheduler.mode", "FIFO")
48+
sc = new SparkContext("local[2]", "test", conf)
5049
testCount()
5150
testTake()
5251
// Make sure we can still launch tasks.
5352
assert(sc.parallelize(1 to 10, 2).count === 10)
5453
}
5554

5655
test("local mode, fair scheduler") {
57-
System.setProperty("spark.scheduler.mode", "FAIR")
56+
val conf = new SparkConf().set("spark.scheduler.mode", "FAIR")
5857
val xmlPath = getClass.getClassLoader.getResource("fairscheduler.xml").getFile()
59-
System.setProperty("spark.scheduler.allocation.file", xmlPath)
60-
sc = new SparkContext("local[2]", "test")
58+
conf.set("spark.scheduler.allocation.file", xmlPath)
59+
sc = new SparkContext("local[2]", "test", conf)
6160
testCount()
6261
testTake()
6362
// Make sure we can still launch tasks.
6463
assert(sc.parallelize(1 to 10, 2).count === 10)
6564
}
6665

6766
test("cluster mode, FIFO scheduler") {
68-
System.setProperty("spark.scheduler.mode", "FIFO")
69-
sc = new SparkContext("local-cluster[2,1,512]", "test")
67+
val conf = new SparkConf().set("spark.scheduler.mode", "FIFO")
68+
sc = new SparkContext("local-cluster[2,1,512]", "test", conf)
7069
testCount()
7170
testTake()
7271
// Make sure we can still launch tasks.
7372
assert(sc.parallelize(1 to 10, 2).count === 10)
7473
}
7574

7675
test("cluster mode, fair scheduler") {
77-
System.setProperty("spark.scheduler.mode", "FAIR")
76+
val conf = new SparkConf().set("spark.scheduler.mode", "FAIR")
7877
val xmlPath = getClass.getClassLoader.getResource("fairscheduler.xml").getFile()
79-
System.setProperty("spark.scheduler.allocation.file", xmlPath)
80-
sc = new SparkContext("local-cluster[2,1,512]", "test")
78+
conf.set("spark.scheduler.allocation.file", xmlPath)
79+
sc = new SparkContext("local-cluster[2,1,512]", "test", conf)
8180
testCount()
8281
testTake()
8382
// Make sure we can still launch tasks.

core/src/test/scala/org/apache/spark/ShuffleSuite.scala

Lines changed: 9 additions & 13 deletions
Original file line numberDiff line numberDiff line change
@@ -31,19 +31,15 @@ class ShuffleSuite extends FunSuite with ShouldMatchers with LocalSparkContext {
3131
val conf = new SparkConf(loadDefaults = false)
3232

3333
test("groupByKey without compression") {
34-
try {
35-
System.setProperty("spark.shuffle.compress", "false")
36-
sc = new SparkContext("local", "test")
37-
val pairs = sc.parallelize(Array((1, 1), (1, 2), (1, 3), (2, 1)), 4)
38-
val groups = pairs.groupByKey(4).collect()
39-
assert(groups.size === 2)
40-
val valuesFor1 = groups.find(_._1 == 1).get._2
41-
assert(valuesFor1.toList.sorted === List(1, 2, 3))
42-
val valuesFor2 = groups.find(_._1 == 2).get._2
43-
assert(valuesFor2.toList.sorted === List(1))
44-
} finally {
45-
System.setProperty("spark.shuffle.compress", "true")
46-
}
34+
val myConf = conf.clone().set("spark.shuffle.compress", "false")
35+
sc = new SparkContext("local", "test", myConf)
36+
val pairs = sc.parallelize(Array((1, 1), (1, 2), (1, 3), (2, 1)), 4)
37+
val groups = pairs.groupByKey(4).collect()
38+
assert(groups.size === 2)
39+
val valuesFor1 = groups.find(_._1 == 1).get._2
40+
assert(valuesFor1.toList.sorted === List(1, 2, 3))
41+
val valuesFor2 = groups.find(_._1 == 2).get._2
42+
assert(valuesFor2.toList.sorted === List(1))
4743
}
4844

4945
test("shuffle non-zero block size") {

core/src/test/scala/org/apache/spark/SparkConfSuite.scala

Lines changed: 20 additions & 32 deletions
Original file line numberDiff line numberDiff line change
@@ -19,25 +19,19 @@ package org.apache.spark
1919

2020
import org.scalatest.FunSuite
2121

22-
class SparkConfSuite extends FunSuite with LocalSparkContext {
22+
import org.apache.spark.util.ResetSystemProperties
23+
24+
class SparkConfSuite extends FunSuite with LocalSparkContext with ResetSystemProperties {
2325
test("loading from system properties") {
24-
try {
25-
System.setProperty("spark.test.testProperty", "2")
26-
val conf = new SparkConf()
27-
assert(conf.get("spark.test.testProperty") === "2")
28-
} finally {
29-
System.clearProperty("spark.test.testProperty")
30-
}
26+
System.setProperty("spark.test.testProperty", "2")
27+
val conf = new SparkConf()
28+
assert(conf.get("spark.test.testProperty") === "2")
3129
}
3230

3331
test("initializing without loading defaults") {
34-
try {
35-
System.setProperty("spark.test.testProperty", "2")
36-
val conf = new SparkConf(false)
37-
assert(!conf.contains("spark.test.testProperty"))
38-
} finally {
39-
System.clearProperty("spark.test.testProperty")
40-
}
32+
System.setProperty("spark.test.testProperty", "2")
33+
val conf = new SparkConf(false)
34+
assert(!conf.contains("spark.test.testProperty"))
4135
}
4236

4337
test("named set methods") {
@@ -115,22 +109,16 @@ class SparkConfSuite extends FunSuite with LocalSparkContext {
115109

116110
test("nested property names") {
117111
// This wasn't supported by some external conf parsing libraries
118-
try {
119-
System.setProperty("spark.test.a", "a")
120-
System.setProperty("spark.test.a.b", "a.b")
121-
System.setProperty("spark.test.a.b.c", "a.b.c")
122-
val conf = new SparkConf()
123-
assert(conf.get("spark.test.a") === "a")
124-
assert(conf.get("spark.test.a.b") === "a.b")
125-
assert(conf.get("spark.test.a.b.c") === "a.b.c")
126-
conf.set("spark.test.a.b", "A.B")
127-
assert(conf.get("spark.test.a") === "a")
128-
assert(conf.get("spark.test.a.b") === "A.B")
129-
assert(conf.get("spark.test.a.b.c") === "a.b.c")
130-
} finally {
131-
System.clearProperty("spark.test.a")
132-
System.clearProperty("spark.test.a.b")
133-
System.clearProperty("spark.test.a.b.c")
134-
}
112+
System.setProperty("spark.test.a", "a")
113+
System.setProperty("spark.test.a.b", "a.b")
114+
System.setProperty("spark.test.a.b.c", "a.b.c")
115+
val conf = new SparkConf()
116+
assert(conf.get("spark.test.a") === "a")
117+
assert(conf.get("spark.test.a.b") === "a.b")
118+
assert(conf.get("spark.test.a.b.c") === "a.b.c")
119+
conf.set("spark.test.a.b", "A.B")
120+
assert(conf.get("spark.test.a") === "a")
121+
assert(conf.get("spark.test.a.b") === "A.B")
122+
assert(conf.get("spark.test.a.b.c") === "a.b.c")
135123
}
136124
}

core/src/test/scala/org/apache/spark/SparkContextSchedulerCreationSuite.scala

Lines changed: 11 additions & 10 deletions
Original file line numberDiff line numberDiff line change
@@ -27,10 +27,13 @@ import org.apache.spark.scheduler.local.LocalBackend
2727
class SparkContextSchedulerCreationSuite
2828
extends FunSuite with PrivateMethodTester with LocalSparkContext with Logging {
2929

30-
def createTaskScheduler(master: String): TaskSchedulerImpl = {
30+
def createTaskScheduler(master: String): TaskSchedulerImpl =
31+
createTaskScheduler(master, new SparkConf())
32+
33+
def createTaskScheduler(master: String, conf: SparkConf): TaskSchedulerImpl = {
3134
// Create local SparkContext to setup a SparkEnv. We don't actually want to start() the
3235
// real schedulers, so we don't want to create a full SparkContext with the desired scheduler.
33-
sc = new SparkContext("local", "test")
36+
sc = new SparkContext("local", "test", conf)
3437
val createTaskSchedulerMethod = PrivateMethod[TaskScheduler]('createTaskScheduler)
3538
val sched = SparkContext invokePrivate createTaskSchedulerMethod(sc, master)
3639
sched.asInstanceOf[TaskSchedulerImpl]
@@ -115,9 +118,10 @@ class SparkContextSchedulerCreationSuite
115118
testYarn("yarn-client", "org.apache.spark.scheduler.cluster.YarnClientClusterScheduler")
116119
}
117120

118-
def testMesos(master: String, expectedClass: Class[_]) {
121+
def testMesos(master: String, expectedClass: Class[_], coarse: Boolean) {
122+
val conf = new SparkConf().set("spark.mesos.coarse", coarse.toString)
119123
try {
120-
val sched = createTaskScheduler(master)
124+
val sched = createTaskScheduler(master, conf)
121125
assert(sched.backend.getClass === expectedClass)
122126
} catch {
123127
case e: UnsatisfiedLinkError =>
@@ -128,17 +132,14 @@ class SparkContextSchedulerCreationSuite
128132
}
129133

130134
test("mesos fine-grained") {
131-
System.setProperty("spark.mesos.coarse", "false")
132-
testMesos("mesos://localhost:1234", classOf[MesosSchedulerBackend])
135+
testMesos("mesos://localhost:1234", classOf[MesosSchedulerBackend], coarse = false)
133136
}
134137

135138
test("mesos coarse-grained") {
136-
System.setProperty("spark.mesos.coarse", "true")
137-
testMesos("mesos://localhost:1234", classOf[CoarseMesosSchedulerBackend])
139+
testMesos("mesos://localhost:1234", classOf[CoarseMesosSchedulerBackend], coarse = true)
138140
}
139141

140142
test("mesos with zookeeper") {
141-
System.setProperty("spark.mesos.coarse", "false")
142-
testMesos("zk://localhost:1234,localhost:2345", classOf[MesosSchedulerBackend])
143+
testMesos("zk://localhost:1234,localhost:2345", classOf[MesosSchedulerBackend], coarse = false)
143144
}
144145
}

core/src/test/scala/org/apache/spark/deploy/SparkSubmitSuite.scala

Lines changed: 4 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -23,11 +23,13 @@ import scala.collection.mutable.ArrayBuffer
2323

2424
import org.apache.spark.{SparkConf, SparkContext, SparkEnv, SparkException, TestUtils}
2525
import org.apache.spark.deploy.SparkSubmit._
26-
import org.apache.spark.util.Utils
26+
import org.apache.spark.util.{ResetSystemProperties, Utils}
2727
import org.scalatest.FunSuite
2828
import org.scalatest.matchers.ShouldMatchers
2929

30-
class SparkSubmitSuite extends FunSuite with ShouldMatchers {
30+
// Note: this suite mixes in ResetSystemProperties because SparkSubmit.main() sets a bunch
31+
// of properties that neeed to be cleared after tests.
32+
class SparkSubmitSuite extends FunSuite with ShouldMatchers with ResetSystemProperties {
3133
def beforeAll() {
3234
System.setProperty("spark.testing", "true")
3335
}

0 commit comments

Comments
 (0)