diff options
Diffstat (limited to 'repl/src')
-rw-r--r-- | repl/src/main/scala/spark/repl/SparkILoop.scala | 2 | ||||
-rw-r--r-- | repl/src/test/resources/log4j.properties | 10 | ||||
-rw-r--r-- | repl/src/test/scala/spark/repl/ReplSuite.scala | 25 |
3 files changed, 31 insertions, 6 deletions
diff --git a/repl/src/main/scala/spark/repl/SparkILoop.scala b/repl/src/main/scala/spark/repl/SparkILoop.scala index faece8baa4..22bcb4be8a 100644 --- a/repl/src/main/scala/spark/repl/SparkILoop.scala +++ b/repl/src/main/scala/spark/repl/SparkILoop.scala @@ -200,7 +200,7 @@ class SparkILoop(in0: Option[BufferedReader], val out: PrintWriter, val master: ____ __ / __/__ ___ _____/ /__ _\ \/ _ \/ _ `/ __/ '_/ - /___/ .__/\_,_/_/ /_/\_\ version 0.6.0-SNAPSHOT + /___/ .__/\_,_/_/ /_/\_\ version 0.7.0 /_/ """) import Properties._ diff --git a/repl/src/test/resources/log4j.properties b/repl/src/test/resources/log4j.properties index 02fe16866e..4c99e450bc 100644 --- a/repl/src/test/resources/log4j.properties +++ b/repl/src/test/resources/log4j.properties @@ -1,8 +1,10 @@ # Set everything to be logged to the console -log4j.rootCategory=WARN, console -log4j.appender.console=org.apache.log4j.ConsoleAppender -log4j.appender.console.layout=org.apache.log4j.PatternLayout -log4j.appender.console.layout.ConversionPattern=%d{yy/MM/dd HH:mm:ss.SSS} %p %c{1}: %m%n +log4j.rootCategory=INFO, file +log4j.appender.file=org.apache.log4j.FileAppender +log4j.appender.file.append=false +log4j.appender.file.file=spark-tests.log +log4j.appender.file.layout=org.apache.log4j.PatternLayout +log4j.appender.file.layout.ConversionPattern=%d{yy/MM/dd HH:mm:ss.SSS} %p %c{1}: %m%n # Ignore messages below warning level from Jetty, because it's a bit verbose log4j.logger.org.eclipse.jetty=WARN diff --git a/repl/src/test/scala/spark/repl/ReplSuite.scala b/repl/src/test/scala/spark/repl/ReplSuite.scala index 15ebf0c9b8..db78d06d4f 100644 --- a/repl/src/test/scala/spark/repl/ReplSuite.scala +++ b/repl/src/test/scala/spark/repl/ReplSuite.scala @@ -7,6 +7,7 @@ import scala.collection.mutable.ArrayBuffer import scala.collection.JavaConversions._ import org.scalatest.FunSuite +import com.google.common.io.Files class ReplSuite extends FunSuite { def runInterpreter(master: String, input: String): String = { @@ -29,6 +30,8 @@ class ReplSuite extends FunSuite { spark.repl.Main.interp = null if (interp.sparkContext != null) interp.sparkContext.stop() + // To avoid Akka rebinding to the same port, since it doesn't unbind immediately on shutdown + System.clearProperty("spark.master.port") return out.toString } @@ -118,7 +121,27 @@ class ReplSuite extends FunSuite { assertContains("res0: Array[Int] = Array(0, 0, 0, 0, 0)", output) assertContains("res2: Array[Int] = Array(5, 0, 0, 0, 0)", output) } - + + test ("interacting with files") { + val tempDir = Files.createTempDir() + val out = new FileWriter(tempDir + "/input") + out.write("Hello world!\n") + out.write("What's up?\n") + out.write("Goodbye\n") + out.close() + val output = runInterpreter("local", """ + var file = sc.textFile("%s/input").cache() + file.count() + file.count() + file.count() + """.format(tempDir.getAbsolutePath)) + assertDoesNotContain("error:", output) + assertDoesNotContain("Exception", output) + assertContains("res0: Long = 3", output) + assertContains("res1: Long = 3", output) + assertContains("res2: Long = 3", output) + } + if (System.getenv("MESOS_NATIVE_LIBRARY") != null) { test ("running on Mesos") { val output = runInterpreter("localquiet", """ |