Skip to content

Commit bd86cb1

Browse files
RongGupwendell
authored andcommitted
[SPARK-2703][Core]Make Tachyon related unit tests execute without deploying a Tachyon system locally.
Make Tachyon related unit tests execute without deploying a Tachyon system locally. Author: RongGu <[email protected]> Closes #3030 from RongGu/SPARK-2703 and squashes the following commits: ad08827 [RongGu] Make Tachyon related unit tests execute without deploying a Tachyon system locally
1 parent 227488d commit bd86cb1

File tree

3 files changed

+18
-2
lines changed

3 files changed

+18
-2
lines changed

core/pom.xml

Lines changed: 7 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -204,6 +204,13 @@
204204
<artifactId>derby</artifactId>
205205
<scope>test</scope>
206206
</dependency>
207+
<dependency>
208+
<groupId>org.tachyonproject</groupId>
209+
<artifactId>tachyon</artifactId>
210+
<version>0.5.0</version>
211+
<type>test-jar</type>
212+
<scope>test</scope>
213+
</dependency>
207214
<dependency>
208215
<groupId>org.tachyonproject</groupId>
209216
<artifactId>tachyon-client</artifactId>

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

Lines changed: 9 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -36,6 +36,7 @@ import org.mockito.Mockito.{mock, when}
3636
import org.scalatest.{BeforeAndAfter, FunSuite, Matchers, PrivateMethodTester}
3737
import org.scalatest.concurrent.Eventually._
3838
import org.scalatest.concurrent.Timeouts._
39+
import tachyon.master.LocalTachyonCluster
3940

4041
import org.apache.spark.{MapOutputTrackerMaster, SparkConf, SparkContext, SecurityManager}
4142
import org.apache.spark.executor.DataReadMethod
@@ -536,9 +537,14 @@ class BlockManagerSuite extends FunSuite with Matchers with BeforeAndAfter
536537
}
537538

538539
test("tachyon storage") {
539-
// TODO Make the spark.test.tachyon.enable true after using tachyon 0.5.0 testing jar.
540-
val tachyonUnitTestEnabled = conf.getBoolean("spark.test.tachyon.enable", false)
540+
val tachyonUnitTestEnabled = conf.getBoolean("spark.test.tachyon.enable", true)
541541
if (tachyonUnitTestEnabled) {
542+
val tachyonCluster = new LocalTachyonCluster(30000000)
543+
tachyonCluster.start()
544+
val tachyonURL = tachyon.Constants.HEADER +
545+
tachyonCluster.getMasterHostname() + ":" + tachyonCluster.getMasterPort()
546+
conf.set("spark.tachyonStore.url", tachyonURL)
547+
conf.set("spark.tachyonStore.folderName", "app-test")
542548
store = makeBlockManager(1200)
543549
val a1 = new Array[Byte](400)
544550
val a2 = new Array[Byte](400)
@@ -549,6 +555,7 @@ class BlockManagerSuite extends FunSuite with Matchers with BeforeAndAfter
549555
assert(store.getSingle("a3").isDefined, "a3 was in store")
550556
assert(store.getSingle("a2").isDefined, "a2 was in store")
551557
assert(store.getSingle("a1").isDefined, "a1 was in store")
558+
tachyonCluster.stop()
552559
} else {
553560
info("tachyon storage test disabled.")
554561
}

project/SparkBuild.scala

Lines changed: 2 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -360,6 +360,8 @@ object TestSettings {
360360
testOptions += Tests.Argument(TestFrameworks.JUnit, "-v", "-a"),
361361
// Enable Junit testing.
362362
libraryDependencies += "com.novocode" % "junit-interface" % "0.9" % "test",
363+
// Enable Tachyon local testing.
364+
libraryDependencies += "org.tachyonproject" % "tachyon" % "0.5.0" % "test" classifier "tests",
363365
// Only allow one test at a time, even across projects, since they run in the same JVM
364366
parallelExecution in Test := false,
365367
concurrentRestrictions in Global += Tags.limit(Tags.Test, 1),

0 commit comments

Comments
 (0)