-
Notifications
You must be signed in to change notification settings - Fork 3.6k
Add reusable connector smoke test #7155
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
Changes from all commits
File filter
Filter by extension
Conversations
Jump to
Diff view
Diff view
There are no files selected for viewing
| Original file line number | Diff line number | Diff line change |
|---|---|---|
| @@ -0,0 +1,19 @@ | ||
| /* | ||
| * Licensed 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 io.trino.plugin.jdbc; | ||
|
|
||
| import io.trino.testing.BaseConnectorSmokeTest; | ||
|
|
||
| public abstract class BaseJdbcConnectorSmokeTest | ||
| extends BaseConnectorSmokeTest {} |
| Original file line number | Diff line number | Diff line change |
|---|---|---|
|
|
@@ -14,14 +14,13 @@ | |
| package io.trino.plugin.mysql; | ||
|
|
||
| import com.google.common.collect.ImmutableMap; | ||
| import io.trino.plugin.jdbc.BaseJdbcConnectorSmokeTest; | ||
| import io.trino.testing.QueryRunner; | ||
| import io.trino.testing.sql.SqlExecutor; | ||
|
|
||
| import static io.trino.plugin.mysql.MySqlQueryRunner.createMySqlQueryRunner; | ||
|
|
||
| public class TestGlobalTransactionMySqlConnectorTest | ||
| // TODO(https://github.com/trinodb/trino/issues/7019) define shorter tests set that exercises various read and write scenarios (a.k.a. "a smoke test") | ||
| extends BaseMySqlConnectorTest | ||
| public class TestMySqlGlobalTransactionMyConnectorSmokeTest | ||
| extends BaseJdbcConnectorSmokeTest | ||
|
||
| { | ||
| private TestingMySqlServer mysqlServer; | ||
|
|
||
|
|
@@ -32,10 +31,4 @@ protected QueryRunner createQueryRunner() | |
| mysqlServer = closeAfterClass(new TestingMySqlServer(true)); | ||
| return createMySqlQueryRunner(mysqlServer, ImmutableMap.of(), ImmutableMap.of(), REQUIRED_TPCH_TABLES); | ||
| } | ||
|
|
||
| @Override | ||
| protected SqlExecutor getMySqlExecutor() | ||
| { | ||
| return mysqlServer::execute; | ||
| } | ||
| } | ||
| Original file line number | Diff line number | Diff line change |
|---|---|---|
| @@ -0,0 +1,52 @@ | ||
| /* | ||
| * Licensed 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 io.trino.plugin.oracle; | ||
|
|
||
| import io.trino.plugin.jdbc.BaseJdbcConnectorSmokeTest; | ||
| import io.trino.testing.TestingConnectorBehavior; | ||
| import org.testng.annotations.Test; | ||
|
|
||
| import static io.trino.testing.sql.TestTable.randomTableSuffix; | ||
| import static org.assertj.core.api.Assertions.assertThat; | ||
|
|
||
| public abstract class BaseOracleConnectorSmokeTest | ||
| extends BaseJdbcConnectorSmokeTest | ||
| { | ||
| @Override | ||
| protected boolean hasBehavior(TestingConnectorBehavior connectorBehavior) | ||
| { | ||
| switch (connectorBehavior) { | ||
| case SUPPORTS_CREATE_SCHEMA: | ||
| return false; | ||
|
|
||
| default: | ||
| return super.hasBehavior(connectorBehavior); | ||
| } | ||
| } | ||
|
|
||
| @Test | ||
| public void testCommentColumn() | ||
| { | ||
| String tableName = "test_comment_column_" + randomTableSuffix(); | ||
|
|
||
| assertUpdate("CREATE TABLE " + tableName + "(a integer)"); | ||
|
|
||
| // comment set | ||
| assertUpdate("COMMENT ON COLUMN " + tableName + ".a IS 'new comment'"); | ||
| // without remarksReporting (default) Oracle does not return comments set | ||
| assertThat((String) computeActual("SHOW CREATE TABLE " + tableName).getOnlyValue()).doesNotContain("COMMENT 'new comment'"); | ||
|
|
||
| assertUpdate("DROP TABLE " + tableName); | ||
| } | ||
| } |
Uh oh!
There was an error while loading. Please reload this page.