Skip to content

Commit ad08827

Browse files
committed
Make Tachyon related unit tests execute without deploying a Tachyon system locally
1 parent c7ad085 commit ad08827

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
@@ -199,6 +199,13 @@
199199
<artifactId>derby</artifactId>
200200
<scope>test</scope>
201201
</dependency>
202+
<dependency>
203+
<groupId>org.tachyonproject</groupId>
204+
<artifactId>tachyon</artifactId>
205+
<version>0.5.0</version>
206+
<type>test-jar</type>
207+
<scope>test</scope>
208+
</dependency>
202209
<dependency>
203210
<groupId>org.tachyonproject</groupId>
204211
<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, SecurityManager, SparkConf}
4142
import org.apache.spark.executor.DataReadMethod
@@ -532,9 +533,14 @@ class BlockManagerSuite extends FunSuite with Matchers with BeforeAndAfter
532533
}
533534

534535
test("tachyon storage") {
535-
// TODO Make the spark.test.tachyon.enable true after using tachyon 0.5.0 testing jar.
536-
val tachyonUnitTestEnabled = conf.getBoolean("spark.test.tachyon.enable", false)
536+
val tachyonUnitTestEnabled = conf.getBoolean("spark.test.tachyon.enable", true)
537537
if (tachyonUnitTestEnabled) {
538+
val tachyonCluster = new LocalTachyonCluster(30000000)
539+
tachyonCluster.start()
540+
val tachyonURL = tachyon.Constants.HEADER +
541+
tachyonCluster.getMasterHostname() + ":" + tachyonCluster.getMasterPort()
542+
conf.set("spark.tachyonStore.url", tachyonURL)
543+
conf.set("spark.tachyonStore.folderName", "app-test")
538544
store = makeBlockManager(1200)
539545
val a1 = new Array[Byte](400)
540546
val a2 = new Array[Byte](400)
@@ -545,6 +551,7 @@ class BlockManagerSuite extends FunSuite with Matchers with BeforeAndAfter
545551
assert(store.getSingle("a3").isDefined, "a3 was in store")
546552
assert(store.getSingle("a2").isDefined, "a2 was in store")
547553
assert(store.getSingle("a1").isDefined, "a1 was in store")
554+
tachyonCluster.stop()
548555
} else {
549556
info("tachyon storage test disabled.")
550557
}

project/SparkBuild.scala

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

0 commit comments

Comments
 (0)