From c2fb0c6bff36ac6a8a2e4f31e50044a6ab41574f Mon Sep 17 00:00:00 2001 From: Yuya Ebihara Date: Fri, 17 Nov 2023 18:17:20 +0900 Subject: [PATCH] Change latest connector test to smoke test in MariaDB Also, update the docker image versions. --- docs/src/main/sphinx/connector/mariadb.md | 2 +- .../mariadb/TestMariaDbConnectorTest.java | 28 ------------------- ... TestMariaDbLatestConnectorSmokeTest.java} | 22 +++++++++------ .../plugin/mariadb/TestingMariaDbServer.java | 4 +-- 4 files changed, 16 insertions(+), 40 deletions(-) rename plugin/trino-mariadb/src/test/java/io/trino/plugin/mariadb/{TestMariaDbLatestConnectorTest.java => TestMariaDbLatestConnectorSmokeTest.java} (66%) diff --git a/docs/src/main/sphinx/connector/mariadb.md b/docs/src/main/sphinx/connector/mariadb.md index 700843215c71..5eacada0501e 100644 --- a/docs/src/main/sphinx/connector/mariadb.md +++ b/docs/src/main/sphinx/connector/mariadb.md @@ -17,7 +17,7 @@ database. To connect to MariaDB, you need: -- MariaDB version 10.2 or higher. +- MariaDB version 10.10 or higher. - Network access from the Trino coordinator and workers to MariaDB. Port 3306 is the default port. diff --git a/plugin/trino-mariadb/src/test/java/io/trino/plugin/mariadb/TestMariaDbConnectorTest.java b/plugin/trino-mariadb/src/test/java/io/trino/plugin/mariadb/TestMariaDbConnectorTest.java index 42a7bf7432e8..639bead397da 100644 --- a/plugin/trino-mariadb/src/test/java/io/trino/plugin/mariadb/TestMariaDbConnectorTest.java +++ b/plugin/trino-mariadb/src/test/java/io/trino/plugin/mariadb/TestMariaDbConnectorTest.java @@ -16,10 +16,8 @@ import com.google.common.collect.ImmutableMap; import io.trino.testing.QueryRunner; import io.trino.testing.sql.SqlExecutor; -import org.junit.jupiter.api.Test; import static io.trino.plugin.mariadb.MariaDbQueryRunner.createMariaDbQueryRunner; -import static org.assertj.core.api.Assertions.assertThatThrownBy; public class TestMariaDbConnectorTest extends BaseMariaDbConnectorTest @@ -37,30 +35,4 @@ protected SqlExecutor onRemoteDatabase() { return server::execute; } - - @Test - @Override - public void testRenameColumn() - { - assertThatThrownBy(super::testRenameColumn) - .hasMessageContaining("Rename column not supported for the MariaDB server version"); - } - - @Test - @Override - public void testRenameColumnName() - { - for (String columnName : testColumnNameDataProvider()) { - assertThatThrownBy(() -> testRenameColumnName(columnName, requiresDelimiting(columnName))) - .hasMessageContaining("Rename column not supported for the MariaDB server version"); - } - } - - @Test - @Override - public void testAlterTableRenameColumnToLongName() - { - assertThatThrownBy(super::testAlterTableRenameColumnToLongName) - .hasMessageContaining("Rename column not supported for the MariaDB server version"); - } } diff --git a/plugin/trino-mariadb/src/test/java/io/trino/plugin/mariadb/TestMariaDbLatestConnectorTest.java b/plugin/trino-mariadb/src/test/java/io/trino/plugin/mariadb/TestMariaDbLatestConnectorSmokeTest.java similarity index 66% rename from plugin/trino-mariadb/src/test/java/io/trino/plugin/mariadb/TestMariaDbLatestConnectorTest.java rename to plugin/trino-mariadb/src/test/java/io/trino/plugin/mariadb/TestMariaDbLatestConnectorSmokeTest.java index 7664ef9e0cb3..186eeb250cc6 100644 --- a/plugin/trino-mariadb/src/test/java/io/trino/plugin/mariadb/TestMariaDbLatestConnectorTest.java +++ b/plugin/trino-mariadb/src/test/java/io/trino/plugin/mariadb/TestMariaDbLatestConnectorSmokeTest.java @@ -14,26 +14,30 @@ package io.trino.plugin.mariadb; import com.google.common.collect.ImmutableMap; +import io.trino.plugin.jdbc.BaseJdbcConnectorSmokeTest; import io.trino.testing.QueryRunner; -import io.trino.testing.sql.SqlExecutor; +import io.trino.testing.TestingConnectorBehavior; import static io.trino.plugin.mariadb.MariaDbQueryRunner.createMariaDbQueryRunner; import static io.trino.plugin.mariadb.TestingMariaDbServer.LATEST_VERSION; -public class TestMariaDbLatestConnectorTest - extends BaseMariaDbConnectorTest +public class TestMariaDbLatestConnectorSmokeTest + extends BaseJdbcConnectorSmokeTest { @Override - protected QueryRunner createQueryRunner() - throws Exception + protected boolean hasBehavior(TestingConnectorBehavior connectorBehavior) { - server = closeAfterClass(new TestingMariaDbServer(LATEST_VERSION)); - return createMariaDbQueryRunner(server, ImmutableMap.of(), ImmutableMap.of(), REQUIRED_TPCH_TABLES); + return switch (connectorBehavior) { + case SUPPORTS_RENAME_SCHEMA -> false; + default -> super.hasBehavior(connectorBehavior); + }; } @Override - protected SqlExecutor onRemoteDatabase() + protected QueryRunner createQueryRunner() + throws Exception { - return server::execute; + TestingMariaDbServer server = closeAfterClass(new TestingMariaDbServer(LATEST_VERSION)); + return createMariaDbQueryRunner(server, ImmutableMap.of(), ImmutableMap.of(), REQUIRED_TPCH_TABLES); } } diff --git a/plugin/trino-mariadb/src/test/java/io/trino/plugin/mariadb/TestingMariaDbServer.java b/plugin/trino-mariadb/src/test/java/io/trino/plugin/mariadb/TestingMariaDbServer.java index c9796befa167..4d2a6c280172 100644 --- a/plugin/trino-mariadb/src/test/java/io/trino/plugin/mariadb/TestingMariaDbServer.java +++ b/plugin/trino-mariadb/src/test/java/io/trino/plugin/mariadb/TestingMariaDbServer.java @@ -27,8 +27,8 @@ public class TestingMariaDbServer implements AutoCloseable { - public static final String LATEST_VERSION = "10.7.1"; - public static final String DEFAULT_VERSION = "10.2"; + public static final String LATEST_VERSION = "11.1.3"; + public static final String DEFAULT_VERSION = "10.10"; private static final int MARIADB_PORT = 3306; private final MariaDBContainer container;