Skip to content

Commit 51aa870

Browse files
committed
Use withSystemProperty in ShuffleSuite
1 parent 60a63a1 commit 51aa870

File tree

1 file changed

+1
-4
lines changed

1 file changed

+1
-4
lines changed

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

Lines changed: 1 addition & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -35,8 +35,7 @@ abstract class ShuffleSuite extends FunSuite with Matchers with LocalSparkContex
3535
conf.set("spark.test.noStageRetry", "true")
3636

3737
test("groupByKey without compression") {
38-
try {
39-
System.setProperty("spark.shuffle.compress", "false")
38+
TestUtils.withSystemProperty("spark.shuffle.compress", "false") {
4039
sc = new SparkContext("local", "test", conf)
4140
val pairs = sc.parallelize(Array((1, 1), (1, 2), (1, 3), (2, 1)), 4)
4241
val groups = pairs.groupByKey(4).collect()
@@ -45,8 +44,6 @@ abstract class ShuffleSuite extends FunSuite with Matchers with LocalSparkContex
4544
assert(valuesFor1.toList.sorted === List(1, 2, 3))
4645
val valuesFor2 = groups.find(_._1 == 2).get._2
4746
assert(valuesFor2.toList.sorted === List(1))
48-
} finally {
49-
System.setProperty("spark.shuffle.compress", "true")
5047
}
5148
}
5249

0 commit comments

Comments
 (0)