Skip to content

Commit b0daff2

Browse files
committed
Use ResetSystemProperties in BlockManagerSuite
1 parent e9ded62 commit b0daff2

File tree

1 file changed

+3
-12
lines changed

1 file changed

+3
-12
lines changed

core/src/test/scala/org/apache/spark/storage/BlockManagerSuite.scala

Lines changed: 3 additions & 12 deletions
Original file line numberDiff line numberDiff line change
@@ -44,18 +44,17 @@ import org.apache.spark.scheduler.LiveListenerBus
4444
import org.apache.spark.serializer.{JavaSerializer, KryoSerializer}
4545
import org.apache.spark.shuffle.hash.HashShuffleManager
4646
import org.apache.spark.storage.BlockManagerMessages.BlockManagerHeartbeat
47-
import org.apache.spark.util.{AkkaUtils, ByteBufferInputStream, SizeEstimator, Utils}
47+
import org.apache.spark.util._
4848

4949

5050
class BlockManagerSuite extends FunSuite with Matchers with BeforeAndAfter
51-
with PrivateMethodTester {
51+
with PrivateMethodTester with ResetSystemProperties {
5252

5353
private val conf = new SparkConf(false)
5454
var store: BlockManager = null
5555
var store2: BlockManager = null
5656
var actorSystem: ActorSystem = null
5757
var master: BlockManagerMaster = null
58-
var oldArch: String = null
5958
conf.set("spark.authenticate", "false")
6059
val securityMgr = new SecurityManager(conf)
6160
val mapOutputTracker = new MapOutputTrackerMaster(conf)
@@ -85,7 +84,7 @@ class BlockManagerSuite extends FunSuite with Matchers with BeforeAndAfter
8584
this.actorSystem = actorSystem
8685

8786
// Set the arch to 64-bit and compressedOops to true to get a deterministic test-case
88-
oldArch = System.setProperty("os.arch", "amd64")
87+
System.setProperty("os.arch", "amd64")
8988
conf.set("os.arch", "amd64")
9089
conf.set("spark.test.useCompressedOops", "true")
9190
conf.set("spark.driver.port", boundPort.toString)
@@ -113,14 +112,6 @@ class BlockManagerSuite extends FunSuite with Matchers with BeforeAndAfter
113112
actorSystem.awaitTermination()
114113
actorSystem = null
115114
master = null
116-
117-
if (oldArch != null) {
118-
conf.set("os.arch", oldArch)
119-
} else {
120-
System.clearProperty("os.arch")
121-
}
122-
123-
System.clearProperty("spark.test.useCompressedOops")
124115
}
125116

126117
test("StorageLevel object caching") {

0 commit comments

Comments
 (0)