diff --git a/src/test/spark/repl/ReplSuite.scala b/src/test/spark/repl/ReplSuite.scala index dcf71182ec33b5df16f8b1f10add6418d0d85fe1..9f41c77ead6ce0997170bfab17e5d4d403131687 100644 --- a/src/test/spark/repl/ReplSuite.scala +++ b/src/test/spark/repl/ReplSuite.scala @@ -39,9 +39,9 @@ class ReplSuite extends FunSuite { test ("external vars") { val output = runInterpreter("local", """ var v = 7 - sc.parallelize(1 to 10).map(x => v).toArray.reduceLeft(_+_) + sc.parallelize(1 to 10).map(x => v).collect.reduceLeft(_+_) v = 10 - sc.parallelize(1 to 10).map(x => v).toArray.reduceLeft(_+_) + sc.parallelize(1 to 10).map(x => v).collect.reduceLeft(_+_) """) assertDoesNotContain("error:", output) assertDoesNotContain("Exception", output) @@ -54,7 +54,7 @@ class ReplSuite extends FunSuite { class C { def foo = 5 } - sc.parallelize(1 to 10).map(x => (new C).foo).toArray.reduceLeft(_+_) + sc.parallelize(1 to 10).map(x => (new C).foo).collect.reduceLeft(_+_) """) assertDoesNotContain("error:", output) assertDoesNotContain("Exception", output) @@ -64,7 +64,7 @@ class ReplSuite extends FunSuite { test ("external functions") { val output = runInterpreter("local", """ def double(x: Int) = x + x - sc.parallelize(1 to 10).map(x => double(x)).toArray.reduceLeft(_+_) + sc.parallelize(1 to 10).map(x => double(x)).collect.reduceLeft(_+_) """) assertDoesNotContain("error:", output) assertDoesNotContain("Exception", output) @@ -75,9 +75,9 @@ class ReplSuite extends FunSuite { val output = runInterpreter("local", """ var v = 7 def getV() = v - sc.parallelize(1 to 10).map(x => getV()).toArray.reduceLeft(_+_) + sc.parallelize(1 to 10).map(x => getV()).collect.reduceLeft(_+_) v = 10 - sc.parallelize(1 to 10).map(x => getV()).toArray.reduceLeft(_+_) + sc.parallelize(1 to 10).map(x => getV()).collect.reduceLeft(_+_) """) assertDoesNotContain("error:", output) assertDoesNotContain("Exception", output) @@ -92,9 +92,9 @@ class ReplSuite extends FunSuite { val output = runInterpreter("local", """ var array = new Array[Int](5) val broadcastArray = sc.broadcast(array) - sc.parallelize(0 to 4).map(x => broadcastArray.value(x)).toArray + sc.parallelize(0 to 4).map(x => broadcastArray.value(x)).collect array(0) = 5 - sc.parallelize(0 to 4).map(x => broadcastArray.value(x)).toArray + sc.parallelize(0 to 4).map(x => broadcastArray.value(x)).collect """) assertDoesNotContain("error:", output) assertDoesNotContain("Exception", output) @@ -103,23 +103,27 @@ class ReplSuite extends FunSuite { } test ("running on Mesos") { - val output = runInterpreter("localquiet", """ - var v = 7 - def getV() = v - sc.parallelize(1 to 10).map(x => getV()).toArray.reduceLeft(_+_) - v = 10 - sc.parallelize(1 to 10).map(x => getV()).toArray.reduceLeft(_+_) - var array = new Array[Int](5) - val broadcastArray = sc.broadcast(array) - sc.parallelize(0 to 4).map(x => broadcastArray.value(x)).toArray - array(0) = 5 - sc.parallelize(0 to 4).map(x => broadcastArray.value(x)).toArray - """) - assertDoesNotContain("error:", output) - assertDoesNotContain("Exception", output) - assertContains("res0: Int = 70", output) - assertContains("res1: Int = 100", output) - assertContains("res2: Array[Int] = Array(0, 0, 0, 0, 0)", output) - assertContains("res4: Array[Int] = Array(0, 0, 0, 0, 0)", output) + if (System.getenv("MESOS_HOME") != null) { + val output = runInterpreter("localquiet", """ + var v = 7 + def getV() = v + sc.parallelize(1 to 10).map(x => getV()).collect.reduceLeft(_+_) + v = 10 + sc.parallelize(1 to 10).map(x => getV()).collect.reduceLeft(_+_) + var array = new Array[Int](5) + val broadcastArray = sc.broadcast(array) + sc.parallelize(0 to 4).map(x => broadcastArray.value(x)).collect + array(0) = 5 + sc.parallelize(0 to 4).map(x => broadcastArray.value(x)).collect + """) + assertDoesNotContain("error:", output) + assertDoesNotContain("Exception", output) + assertContains("res0: Int = 70", output) + assertContains("res1: Int = 100", output) + assertContains("res2: Array[Int] = Array(0, 0, 0, 0, 0)", output) + assertContains("res4: Array[Int] = Array(0, 0, 0, 0, 0)", output) + } else { + info("Skipping \"running on Mesos\" test because MESOS_HOME is not set"); + } } }