aboutsummaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorLuciano Resende <lresende@apache.org>2017-01-26 15:55:49 -0800
committerLuciano Resende <lresende@apache.org>2017-01-26 15:55:49 -0800
commit6ad3447bda3c5cefac1c45ba057c9b8f75751abb (patch)
tree8a7e4172f8b596bda704e1a7757b39f68dabe9d6
parent458a2d31b10701370746f3029c5bc580e85f24d9 (diff)
downloadtoree-gateway-6ad3447bda3c5cefac1c45ba057c9b8f75751abb.tar.gz
toree-gateway-6ad3447bda3c5cefac1c45ba057c9b8f75751abb.tar.bz2
toree-gateway-6ad3447bda3c5cefac1c45ba057c9b8f75751abb.zip
Improve test coverage
-rw-r--r--src/test/scala/org/apache/toree/gateway/ToreeGatewaySpec.scala41
1 files changed, 31 insertions, 10 deletions
diff --git a/src/test/scala/org/apache/toree/gateway/ToreeGatewaySpec.scala b/src/test/scala/org/apache/toree/gateway/ToreeGatewaySpec.scala
index b2b9c03..5bb01c5 100644
--- a/src/test/scala/org/apache/toree/gateway/ToreeGatewaySpec.scala
+++ b/src/test/scala/org/apache/toree/gateway/ToreeGatewaySpec.scala
@@ -23,7 +23,6 @@ import org.apache.toree.kernel.protocol.v5.client.boot.layers.{StandardHandlerIn
import org.scalatest.{FlatSpec, Ignore}
import org.slf4j.LoggerFactory
-@Ignore
class ToreeGatewaySpec extends FlatSpec {
final val log = LoggerFactory.getLogger(this.getClass.getName.stripSuffix("$"))
@@ -31,15 +30,17 @@ class ToreeGatewaySpec extends FlatSpec {
val profileJSON: String = """
{
- "stdin_port": 48701,
- "control_port": 48702,
- "hb_port": 48705,
- "shell_port": 48703,
- "iopub_port": 48704,
- "ip": "9.125.72.72",
- "transport": "tcp",
- "signature_scheme": "hmac-sha256",
- "key": ""
+ "stdin_port": 48701,
+ "control_port": 48702,
+ "hb_port": 48705,
+ "shell_port": 48703,
+ "iopub_port": 48704,
+ "ip": "9.30.137.220",
+ "transport": "tcp",
+ "signature_scheme": "hmac-sha256",
+ "key": "",
+ "py4j_java": 25433,
+ "py4j_python": 25434
}
""".stripMargin
@@ -90,6 +91,16 @@ class ToreeGatewaySpec extends FlatSpec {
assert(result.contains("only showing top 1 row"))
}
+ "gateway" should "evaluate simple math statements" in {
+ val result = toreeGateway.eval(
+ """
+ 1 + 1
+ """.stripMargin
+ ).toString.stripMargin
+
+ assert(result.contains("2"))
+ }
+
"gateway" should "receive error messages when exception is thrown" in {
val result = toreeGateway.eval(
"""
@@ -129,4 +140,14 @@ class ToreeGatewaySpec extends FlatSpec {
assert(result.contains("Hi"))
}
+
+ "gateway" should "import statement sucessfully" in {
+ val result = toreeGateway.eval(
+ """
+ import org.apache.spark.sql.functions._
+ """.stripMargin
+ ).toString.stripMargin
+
+ assert(result.contains("done"))
+ }
}