Skip to content

Commit 633a84a

Browse files
committed
Remove use of system properties in FileServerSuite
1 parent 25bfce2 commit 633a84a

File tree

1 file changed

+10
-10
lines changed

1 file changed

+10
-10
lines changed

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

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

34-
override def withFixture(test: NoArgTest) = {
34+
def newConf: SparkConf = new SparkConf(loadDefaults = false).set("spark.authenticate", "false")
35+
36+
override def beforeEach() {
37+
super.beforeEach()
3538
resetSparkContext()
36-
TestUtils.withSystemProperty("spark.authenticate", "false") {
37-
super.withFixture(test)
38-
}
3939
}
4040

4141
override def beforeAll() {
@@ -74,7 +74,7 @@ class FileServerSuite extends FunSuite with LocalSparkContext {
7474
}
7575

7676
test("Distributing files locally") {
77-
sc = new SparkContext("local[4]", "test")
77+
sc = new SparkContext("local[4]", "test", newConf)
7878
sc.addFile(tmpFile.toString)
7979
val testData = Array((1,1), (1,1), (2,1), (3,5), (2,2), (3,0))
8080
val result = sc.parallelize(testData).reduceByKey {
@@ -108,7 +108,7 @@ class FileServerSuite extends FunSuite with LocalSparkContext {
108108

109109
test("Distributing files locally using URL as input") {
110110
// addFile("file:///....")
111-
sc = new SparkContext("local[4]", "test")
111+
sc = new SparkContext("local[4]", "test", newConf)
112112
sc.addFile(new File(tmpFile.toString).toURI.toString)
113113
val testData = Array((1,1), (1,1), (2,1), (3,5), (2,2), (3,0))
114114
val result = sc.parallelize(testData).reduceByKey {
@@ -122,7 +122,7 @@ class FileServerSuite extends FunSuite with LocalSparkContext {
122122
}
123123

124124
test ("Dynamically adding JARS locally") {
125-
sc = new SparkContext("local[4]", "test")
125+
sc = new SparkContext("local[4]", "test", newConf)
126126
sc.addJar(tmpJarUrl)
127127
val testData = Array((1, 1))
128128
sc.parallelize(testData).foreach { x =>
@@ -133,7 +133,7 @@ class FileServerSuite extends FunSuite with LocalSparkContext {
133133
}
134134

135135
test("Distributing files on a standalone cluster") {
136-
sc = new SparkContext("local-cluster[1,1,512]", "test")
136+
sc = new SparkContext("local-cluster[1,1,512]", "test", newConf)
137137
sc.addFile(tmpFile.toString)
138138
val testData = Array((1,1), (1,1), (2,1), (3,5), (2,2), (3,0))
139139
val result = sc.parallelize(testData).reduceByKey {
@@ -147,7 +147,7 @@ class FileServerSuite extends FunSuite with LocalSparkContext {
147147
}
148148

149149
test ("Dynamically adding JARS on a standalone cluster") {
150-
sc = new SparkContext("local-cluster[1,1,512]", "test")
150+
sc = new SparkContext("local-cluster[1,1,512]", "test", newConf)
151151
sc.addJar(tmpJarUrl)
152152
val testData = Array((1,1))
153153
sc.parallelize(testData).foreach { x =>
@@ -158,7 +158,7 @@ class FileServerSuite extends FunSuite with LocalSparkContext {
158158
}
159159

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

0 commit comments

Comments
 (0)