瀏覽代碼

LIVY-219. Follow-up. Disabled `JobApiIT.run scala jobs` in Scala 2.11 test run. (#216)

Skip integration test `JobApiIT.run scala jobs` in Scala 2.11 test run because the job is compiled in Scala 2.10.
Saisai Shao 8 年之前
父節點
當前提交
b8a0839fc1
共有 2 個文件被更改,包括 16 次插入12 次删除
  1. 4 10
      integration-test/pom.xml
  2. 12 2
      integration-test/src/test/scala/com/cloudera/livy/test/JobApiIT.scala

+ 4 - 10
integration-test/pom.xml

@@ -167,31 +167,25 @@
     <dependency>
       <groupId>org.apache.spark</groupId>
       <artifactId>spark-core_${scala.binary.version}</artifactId>
+      <scope>test</scope>
     </dependency>
 
     <dependency>
       <groupId>org.apache.spark</groupId>
       <artifactId>spark-sql_${scala.binary.version}</artifactId>
+      <scope>test</scope>
     </dependency>
 
     <dependency>
       <groupId>org.apache.spark</groupId>
       <artifactId>spark-streaming_${scala.binary.version}</artifactId>
+      <scope>test</scope>
     </dependency>
 
     <dependency>
       <groupId>org.apache.spark</groupId>
       <artifactId>spark-hive_${scala.binary.version}</artifactId>
-    </dependency>
-
-    <dependency>
-      <groupId>org.apache.spark</groupId>
-      <artifactId>spark-repl_${scala.binary.version}</artifactId>
-    </dependency>
-
-    <dependency>
-      <groupId>org.apache.spark</groupId>
-      <artifactId>spark-yarn_${scala.binary.version}</artifactId>
+      <scope>test</scope>
     </dependency>
 
     <dependency>

+ 12 - 2
integration-test/src/test/scala/com/cloudera/livy/test/JobApiIT.scala

@@ -26,7 +26,7 @@ import java.util.concurrent.{Future => JFuture, TimeUnit}
 import javax.servlet.http.HttpServletResponse
 
 import scala.collection.JavaConverters._
-import scala.util.Try
+import scala.util.{Properties, Try}
 
 import com.fasterxml.jackson.databind.ObjectMapper
 import com.fasterxml.jackson.module.scala.DefaultScalaModule
@@ -37,6 +37,7 @@ import com.cloudera.livy.client.common.HttpMessages._
 import com.cloudera.livy.sessions.SessionKindModule
 import com.cloudera.livy.test.framework.BaseIntegrationTestSuite
 import com.cloudera.livy.test.jobs._
+import com.cloudera.livy.utils.LivySparkUtils
 
 // Proper type representing the return value of "GET /sessions". At some point we should make
 // SessionServlet use something like this.
@@ -157,7 +158,7 @@ class JobApiIT extends BaseIntegrationTestSuite with BeforeAndAfterAll with Logg
     assert(result === "hello")
   }
 
-  test("run scala jobs") {
+  scalaTest("run scala jobs") {
     assume(client2 != null, "Client not active.")
 
     val jobs = Seq(
@@ -175,6 +176,15 @@ class JobApiIT extends BaseIntegrationTestSuite with BeforeAndAfterAll with Logg
     }
   }
 
+  protected def scalaTest(desc: String)(testFn: => Unit): Unit = {
+    test(desc) {
+      assume(sys.env("LIVY_SPARK_SCALA_VERSION") ==
+        LivySparkUtils.formatScalaVersion(Properties.versionNumberString),
+        s"Scala test can only be run with ${Properties.versionString}")
+      testFn
+    }
+  }
+
   test("ensure failing jobs do not affect session state") {
     assume(client2 != null, "Client not active.")