You are viewing a plain text version of this content. The canonical link for it is here.
Posted to commits@livy.apache.org by mg...@apache.org on 2019/08/19 17:21:03 UTC
[incubator-livy] branch master updated: [LIVY-573][TESTS][THRIFT]
Add tests for operation logs retrieval
This is an automated email from the ASF dual-hosted git repository.
mgaido pushed a commit to branch master
in repository https://gitbox.apache.org/repos/asf/incubator-livy.git
The following commit(s) were added to refs/heads/master by this push:
new 22c73e3 [LIVY-573][TESTS][THRIFT] Add tests for operation logs retrieval
22c73e3 is described below
commit 22c73e37fd2c4d93362e576f05ab2a11a7a22714
Author: yihengwang <yi...@tencent.com>
AuthorDate: Mon Aug 19 19:20:42 2019 +0200
[LIVY-573][TESTS][THRIFT] Add tests for operation logs retrieval
## What changes were proposed in this pull request?
Add unit test for operation logs retrieval.
## How was this patch tested?
New unit tests and existing unit test
Author: yihengwang <yi...@tencent.com>
Closes #199 from yiheng/fix_573.
---
.../livy/thriftserver/ThriftServerSuites.scala | 25 ++++++++++++++++++++++
1 file changed, 25 insertions(+)
diff --git a/thriftserver/server/src/test/scala/org/apache/livy/thriftserver/ThriftServerSuites.scala b/thriftserver/server/src/test/scala/org/apache/livy/thriftserver/ThriftServerSuites.scala
index 6411881..e91c0d9 100644
--- a/thriftserver/server/src/test/scala/org/apache/livy/thriftserver/ThriftServerSuites.scala
+++ b/thriftserver/server/src/test/scala/org/apache/livy/thriftserver/ThriftServerSuites.scala
@@ -19,6 +19,8 @@ package org.apache.livy.thriftserver
import java.sql.{Connection, Date, SQLException, Statement}
+import org.apache.hive.jdbc.HiveStatement
+
import org.apache.livy.LivyConf
@@ -177,6 +179,17 @@ trait CommonThriftTests {
assert(columnsResultSet.getString(23) == "NO")
assert(!columnsResultSet.next())
}
+
+ def operationLogRetrievalTest(statement: Statement): Unit = {
+ statement.execute("select 1")
+ val logIterator = statement.asInstanceOf[HiveStatement].getQueryLog().iterator()
+ statement.close()
+
+ // Only execute statement support operation log retrieval and it only produce one log
+ assert(logIterator.next() ==
+ "Livy session has not yet started. Please wait for it to be ready...")
+ assert(!logIterator.hasNext)
+ }
}
class BinaryThriftServerSuite extends ThriftServerBaseTest with CommonThriftTests {
@@ -295,6 +308,12 @@ class BinaryThriftServerSuite extends ThriftServerBaseTest with CommonThriftTest
getColumnsTest(connection)
}
}
+
+ test("operation log retrieval test") {
+ withJdbcStatement { statement =>
+ operationLogRetrievalTest(statement)
+ }
+ }
}
class HttpThriftServerSuite extends ThriftServerBaseTest with CommonThriftTests {
@@ -331,4 +350,10 @@ class HttpThriftServerSuite extends ThriftServerBaseTest with CommonThriftTests
getColumnsTest(connection)
}
}
+
+ test("operation log retrieval test") {
+ withJdbcStatement { statement =>
+ operationLogRetrievalTest(statement)
+ }
+ }
}