Skip to content

Commit

Permalink
[KYUUBI #2348] Add it test for trino engine
Browse files Browse the repository at this point in the history
### _Why are the changes needed?_

Add it test for trino engine

### _How was this patch tested?_
- [X] 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.apache.org/docs/latest/develop_tools/testing.html#running-tests) locally before make a pull request

Closes #2638 from hddong/trino-it.

Closes #2348

cf6b8d5 [hongdongdong] Add IT tests for trino engine

Authored-by: hongdongdong <hongdongdong@cmss.chinamobile.com>
Signed-off-by: hongdongdong <hongdongdong@cmss.chinamobile.com>
  • Loading branch information
hddong committed May 19, 2022
1 parent c210fda commit 33c8162
Show file tree
Hide file tree
Showing 4 changed files with 190 additions and 0 deletions.
99 changes: 99 additions & 0 deletions integration-tests/kyuubi-trino-it/pom.xml
@@ -0,0 +1,99 @@
<?xml version="1.0" encoding="UTF-8"?>
<!--
~ Licensed to the Apache Software Foundation (ASF) under one or more
~ contributor license agreements. See the NOTICE file distributed with
~ this work for additional information regarding copyright ownership.
~ The ASF licenses this file to You under the Apache License, Version 2.0
~ (the "License"); you may not use this file except in compliance with
~ the License. You may obtain a copy of the License at
~
~ http://www.apache.org/licenses/LICENSE-2.0
~
~ Unless required by applicable law or agreed to in writing, software
~ distributed under the License is distributed on an "AS IS" BASIS,
~ WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
~ See the License for the specific language governing permissions and
~ limitations under the License.
-->

<project xmlns="http://maven.apache.org/POM/4.0.0"
xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance"
xsi:schemaLocation="http://maven.apache.org/POM/4.0.0 http://maven.apache.org/xsd/maven-4.0.0.xsd">
<parent>
<artifactId>integration-tests</artifactId>
<groupId>org.apache.kyuubi</groupId>
<version>1.6.0-SNAPSHOT</version>
<relativePath>../pom.xml</relativePath>
</parent>
<modelVersion>4.0.0</modelVersion>

<artifactId>kyuubi-trino-it_2.12</artifactId>
<name>Kyuubi Test Trino IT</name>
<url>https://kyuubi.apache.org/</url>

<dependencies>

<dependency>
<groupId>org.apache.kyuubi</groupId>
<artifactId>kyuubi-common_${scala.binary.version}</artifactId>
<version>${project.version}</version>
<type>test-jar</type>
<scope>test</scope>
</dependency>

<dependency>
<groupId>org.apache.kyuubi</groupId>
<artifactId>kyuubi-server_${scala.binary.version}</artifactId>
<version>${project.version}</version>
</dependency>

<dependency>
<groupId>org.apache.kyuubi</groupId>
<artifactId>kyuubi-server_${scala.binary.version}</artifactId>
<version>${project.version}</version>
<type>test-jar</type>
<scope>test</scope>
</dependency>

<dependency>
<groupId>org.apache.kyuubi</groupId>
<artifactId>kyuubi-hive-jdbc-shaded</artifactId>
<version>${project.version}</version>
<scope>test</scope>
</dependency>

<dependency>
<groupId>org.slf4j</groupId>
<artifactId>jul-to-slf4j</artifactId>
<scope>test</scope>
</dependency>

<!-- trino -->
<dependency>
<groupId>org.apache.kyuubi</groupId>
<artifactId>kyuubi-trino-engine_${scala.binary.version}</artifactId>
<version>${project.version}</version>
<type>test-jar</type>
<scope>test</scope>
</dependency>

<dependency>
<groupId>com.dimafeng</groupId>
<artifactId>testcontainers-scala-scalatest_${scala.binary.version}</artifactId>
<scope>test</scope>
</dependency>

<dependency>
<groupId>com.dimafeng</groupId>
<artifactId>testcontainers-scala-trino_${scala.binary.version}</artifactId>
<scope>test</scope>
</dependency>

<dependency>
<groupId>io.trino</groupId>
<artifactId>trino-jdbc</artifactId>
<scope>test</scope>
</dependency>

</dependencies>
</project>
@@ -0,0 +1,53 @@
/*
* Licensed to the Apache Software Foundation (ASF) under one or more
* contributor license agreements. See the NOTICE file distributed with
* this work for additional information regarding copyright ownership.
* The ASF licenses this file to You under the Apache License, Version 2.0
* (the "License"); you may not use this file except in compliance with
* the License. You may obtain a copy of the License at
*
* http://www.apache.org/licenses/LICENSE-2.0
*
* Unless required by applicable law or agreed to in writing, software
* distributed under the License is distributed on an "AS IS" BASIS,
* WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
* See the License for the specific language governing permissions and
* limitations under the License.
*/

package org.apache.kyuubi.it.trino

import com.dimafeng.testcontainers.TrinoContainer
import com.dimafeng.testcontainers.scalatest.TestContainerForAll
import org.testcontainers.utility.DockerImageName

import org.apache.kyuubi.WithKyuubiServer
import org.apache.kyuubi.config.KyuubiConf
import org.apache.kyuubi.config.KyuubiConf.ENGINE_TRINO_CONNECTION_CATALOG
import org.apache.kyuubi.config.KyuubiConf.ENGINE_TRINO_CONNECTION_URL
import org.apache.kyuubi.config.KyuubiConf.ENGINE_TYPE

trait WithKyuubiServerAndTrinoContainer
extends WithKyuubiServer with TestContainerForAll {

final val IMAGE_VERSION = 363
final val DOCKER_IMAGE_NAME = s"trinodb/trino:${IMAGE_VERSION}"

override val containerDef = TrinoContainer.Def(DockerImageName.parse(DOCKER_IMAGE_NAME))

override protected val conf: KyuubiConf = {
KyuubiConf()
.set(ENGINE_TYPE, "TRINO")
.set(ENGINE_TRINO_CONNECTION_CATALOG, "memory")
}

override def beforeAll(): Unit = {
// start trino cluster containers
withContainers { trinoContainer =>
val trinoConnectionUrl = trinoContainer.jdbcUrl.replace("jdbc:trino", "http")
conf.set(ENGINE_TRINO_CONNECTION_URL, trinoConnectionUrl)

super.beforeAll()
}
}
}
@@ -0,0 +1,37 @@
/*
* Licensed to the Apache Software Foundation (ASF) under one or more
* contributor license agreements. See the NOTICE file distributed with
* this work for additional information regarding copyright ownership.
* The ASF licenses this file to You under the Apache License, Version 2.0
* (the "License"); you may not use this file except in compliance with
* the License. You may obtain a copy of the License at
*
* http://www.apache.org/licenses/LICENSE-2.0
*
* Unless required by applicable law or agreed to in writing, software
* distributed under the License is distributed on an "AS IS" BASIS,
* WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
* See the License for the specific language governing permissions and
* limitations under the License.
*/

package org.apache.kyuubi.it.trino.operation

import org.apache.kyuubi.engine.trino.TrinoQueryTests
import org.apache.kyuubi.it.trino.WithKyuubiServerAndTrinoContainer

/**
* This test is for Kyuubi Server with Trino engine Running on local:
*
* Real World
* ------------------------------------------------------------- ---------------------
* | JDBC | | |
* | Client ----> Kyuubi Server --> Trino Engine | --> | Trino Cluster |
* | | | |
* ------------------------------------------------------------- ---------------------
*/
class TrinoOperationSuite extends TrinoQueryTests with WithKyuubiServerAndTrinoContainer {

override protected def jdbcUrl: String = getJdbcUrl

}
1 change: 1 addition & 0 deletions integration-tests/pom.xml
Expand Up @@ -33,6 +33,7 @@

<modules>
<module>kyuubi-flink-it</module>
<module>kyuubi-trino-it</module>
</modules>

<profiles>
Expand Down

0 comments on commit 33c8162

Please sign in to comment.