[KYUUBI #741] [TEST] Refine test suites
<!-- Thanks for sending a pull request! Here are some tips for you: 1. If this is your first time, please read our contributor guidelines: https://kyuubi.readthedocs.io/en/latest/community/contributions.html 2. If the PR is related to an issue in https://github.com/NetEase/kyuubi/issues, add '[KYUUBI #XXXX]' in your PR title, e.g., '[KYUUBI #XXXX] Your PR title ...'. 3. If the PR is unfinished, add '[WIP]' in your PR title, e.g., '[WIP][KYUUBI #XXXX] Your PR title ...'. --> ### _Why are the changes needed?_ <!-- Please clarify why the changes are needed. For instance, 1. If you add a feature, you can talk about the use case of it. 2. If you fix a bug, you can clarify why it is a bug. --> Rename `KyuubiOperationHiveSuite` to `KyuubiOperationHiveCatalogSuite`; Simplify redundant case in `KyuubiOperationPerConnectionSuite`; ### _How was this patch tested?_ - [ ] Add some test cases that check the changes thoroughly including negative and positive cases if possible - [ ] Add screenshots for manual tests if appropriate - [ ] [Run test](https://kyuubi.readthedocs.io/en/latest/tools/testing.html#running-tests) locally before make a pull request Closes #741 from pan3793/suite. Closes #741 abea3aaf [Cheng Pan] code style 81ada061 [Cheng Pan] refine test suites Authored-by: Cheng Pan <379377944@qq.com> Signed-off-by: ulysses-you <ulyssesyou18@gmail.com>
This commit is contained in:
parent
30ea032924
commit
787a3048eb
@ -26,7 +26,7 @@ import org.apache.hive.service.rpc.thrift.{TExecuteStatementReq, TFetchResultsRe
|
||||
import org.apache.kyuubi.KYUUBI_VERSION
|
||||
|
||||
trait JDBCTests extends BasicJDBCTests {
|
||||
test("execute statement - select null") {
|
||||
test("execute statement - select null") {
|
||||
withJdbcStatement() { statement =>
|
||||
val resultSet = statement.executeQuery("SELECT NULL AS col")
|
||||
assert(resultSet.next())
|
||||
@ -38,7 +38,7 @@ trait JDBCTests extends BasicJDBCTests {
|
||||
}
|
||||
}
|
||||
|
||||
test("execute statement - select boolean") {
|
||||
test("execute statement - select boolean") {
|
||||
withJdbcStatement() { statement =>
|
||||
val resultSet = statement.executeQuery("SELECT false AS col")
|
||||
assert(resultSet.next())
|
||||
@ -50,7 +50,7 @@ trait JDBCTests extends BasicJDBCTests {
|
||||
}
|
||||
}
|
||||
|
||||
test("execute statement - select tinyint") {
|
||||
test("execute statement - select tinyint") {
|
||||
withJdbcStatement() { statement =>
|
||||
val resultSet = statement.executeQuery("SELECT 1Y AS col")
|
||||
assert(resultSet.next())
|
||||
@ -62,7 +62,7 @@ trait JDBCTests extends BasicJDBCTests {
|
||||
}
|
||||
}
|
||||
|
||||
test("execute statement - select smallint") {
|
||||
test("execute statement - select smallint") {
|
||||
withJdbcStatement() { statement =>
|
||||
val resultSet = statement.executeQuery("SELECT 1S AS col")
|
||||
assert(resultSet.next())
|
||||
@ -74,7 +74,7 @@ trait JDBCTests extends BasicJDBCTests {
|
||||
}
|
||||
}
|
||||
|
||||
test("execute statement - select int") {
|
||||
test("execute statement - select int") {
|
||||
withJdbcStatement() { statement =>
|
||||
val resultSet = statement.executeQuery("SELECT 4 AS col")
|
||||
assert(resultSet.next())
|
||||
@ -86,7 +86,7 @@ trait JDBCTests extends BasicJDBCTests {
|
||||
}
|
||||
}
|
||||
|
||||
test("execute statement - select long") {
|
||||
test("execute statement - select long") {
|
||||
withJdbcStatement() { statement =>
|
||||
val resultSet = statement.executeQuery("SELECT 4L AS col")
|
||||
assert(resultSet.next())
|
||||
@ -98,7 +98,7 @@ trait JDBCTests extends BasicJDBCTests {
|
||||
}
|
||||
}
|
||||
|
||||
test("execute statement - select float") {
|
||||
test("execute statement - select float") {
|
||||
withJdbcStatement() { statement =>
|
||||
val resultSet = statement.executeQuery("SELECT cast(1.2 as float) AS col")
|
||||
assert(resultSet.next())
|
||||
@ -110,7 +110,7 @@ trait JDBCTests extends BasicJDBCTests {
|
||||
}
|
||||
}
|
||||
|
||||
test("execute statement - select double") {
|
||||
test("execute statement - select double") {
|
||||
withJdbcStatement() { statement =>
|
||||
val resultSet = statement.executeQuery("SELECT 4.2D AS col")
|
||||
assert(resultSet.next())
|
||||
@ -122,7 +122,7 @@ trait JDBCTests extends BasicJDBCTests {
|
||||
}
|
||||
}
|
||||
|
||||
test("execute statement - select string") {
|
||||
test("execute statement - select string") {
|
||||
withJdbcStatement() { statement =>
|
||||
val resultSet = statement.executeQuery("SELECT 'kentyao' AS col")
|
||||
assert(resultSet.next())
|
||||
@ -134,7 +134,7 @@ trait JDBCTests extends BasicJDBCTests {
|
||||
}
|
||||
}
|
||||
|
||||
test("execute statement - select binary") {
|
||||
test("execute statement - select binary") {
|
||||
withJdbcStatement() { statement =>
|
||||
val resultSet = statement.executeQuery("SELECT cast('kyuubi' as binary) AS col")
|
||||
assert(resultSet.next())
|
||||
@ -146,7 +146,7 @@ trait JDBCTests extends BasicJDBCTests {
|
||||
}
|
||||
}
|
||||
|
||||
test("execute statement - select date") {
|
||||
test("execute statement - select date") {
|
||||
withJdbcStatement() { statement =>
|
||||
val resultSet = statement.executeQuery("SELECT DATE '2018-11-17' AS col")
|
||||
assert(resultSet.next())
|
||||
@ -158,7 +158,7 @@ trait JDBCTests extends BasicJDBCTests {
|
||||
}
|
||||
}
|
||||
|
||||
test("execute statement - select timestamp") {
|
||||
test("execute statement - select timestamp") {
|
||||
withJdbcStatement() { statement =>
|
||||
val resultSet = statement.executeQuery("SELECT TIMESTAMP '2018-11-17 13:33:33' AS col")
|
||||
assert(resultSet.next())
|
||||
@ -170,7 +170,7 @@ trait JDBCTests extends BasicJDBCTests {
|
||||
}
|
||||
}
|
||||
|
||||
test("execute statement - select interval") {
|
||||
test("execute statement - select interval") {
|
||||
withJdbcStatement() { statement =>
|
||||
val resultSet = statement.executeQuery("SELECT interval '1' day AS col")
|
||||
assert(resultSet.next())
|
||||
@ -182,7 +182,7 @@ trait JDBCTests extends BasicJDBCTests {
|
||||
}
|
||||
}
|
||||
|
||||
test("execute statement - select array") {
|
||||
test("execute statement - select array") {
|
||||
withJdbcStatement() { statement =>
|
||||
val resultSet = statement.executeQuery(
|
||||
"SELECT array() AS col1, array(1) AS col2, array(null) AS col3")
|
||||
|
||||
@ -22,7 +22,7 @@ import java.nio.file.Files
|
||||
import org.apache.kyuubi.{Utils, WithKyuubiServer}
|
||||
import org.apache.kyuubi.config.KyuubiConf
|
||||
|
||||
class KyuubiOperationHiveSuite extends WithKyuubiServer with HiveJDBCTests {
|
||||
class KyuubiOperationHiveCatalogSuite extends WithKyuubiServer with HiveJDBCTests {
|
||||
|
||||
private val metastore = {
|
||||
val dir = Utils.createTempDir()
|
||||
@ -26,7 +26,7 @@ import org.apache.kyuubi.config.KyuubiConf
|
||||
/**
|
||||
* UT with Connection level engine shared cost much time, only run basic jdbc tests.
|
||||
*/
|
||||
class KyuubiOperationPerConnectionSuite extends WithKyuubiServer with BasicJDBCTests {
|
||||
class KyuubiOperationPerConnectionSuite extends WithKyuubiServer with JDBCTestUtils {
|
||||
|
||||
override protected def jdbcUrl: String = getJdbcUrl
|
||||
|
||||
|
||||
@ -21,8 +21,9 @@ import org.apache.kyuubi.WithKyuubiServerOnYarn
|
||||
import org.apache.kyuubi.config.KyuubiConf
|
||||
import org.apache.kyuubi.config.KyuubiConf.ENGINE_INIT_TIMEOUT
|
||||
|
||||
class KyuubiOperationYarnClusterSuite extends WithKyuubiServerOnYarn
|
||||
with JDBCTestUtils {
|
||||
class KyuubiOperationYarnClusterSuite extends WithKyuubiServerOnYarn with JDBCTestUtils {
|
||||
|
||||
override protected def jdbcUrl: String = getJdbcUrl
|
||||
|
||||
override protected val kyuubiServerConf: KyuubiConf = {
|
||||
KyuubiConf().set(ENGINE_INIT_TIMEOUT, 300000L)
|
||||
@ -40,6 +41,4 @@ class KyuubiOperationYarnClusterSuite extends WithKyuubiServerOnYarn
|
||||
assert(resultSet.getString("id").startsWith("application_"))
|
||||
}
|
||||
}
|
||||
|
||||
override protected def jdbcUrl: String = getJdbcUrl
|
||||
}
|
||||
|
||||
@ -17,7 +17,7 @@
|
||||
|
||||
package org.apache.kyuubi.operation.tpcds
|
||||
|
||||
import java.nio.charset.Charset
|
||||
import java.nio.charset.StandardCharsets
|
||||
import java.nio.file.{Files, Path, Paths}
|
||||
|
||||
import org.apache.kyuubi.{DeltaSuiteMixin, WithKyuubiServer}
|
||||
@ -73,12 +73,10 @@ class OutputSchemaTPCDSSuite extends WithKyuubiServer
|
||||
}
|
||||
|
||||
private val regenerateGoldenFiles = sys.env.get("KYUUBI_UPDATE").contains("1")
|
||||
protected val baseResourcePath: Path = {
|
||||
java.nio.file.Paths.get("src", "test", "resources")
|
||||
}
|
||||
protected val baseResourcePath: Path = Paths.get("src", "test", "resources")
|
||||
|
||||
private def fileToString(file: Path): String = {
|
||||
new String(Files.readAllBytes(file), Charset.forName("UTF-8"))
|
||||
new String(Files.readAllBytes(file), StandardCharsets.UTF_8)
|
||||
}
|
||||
|
||||
private def runQuery(query: String, goldenFile: Path): Unit = {
|
||||
|
||||
Loading…
Reference in New Issue
Block a user