From 04d9fbe6c127e53254bee8ba10b7202c38ae484b Mon Sep 17 00:00:00 2001 From: Grant Nicholas Date: Thu, 24 Feb 2022 11:47:11 -0600 Subject: [PATCH] Rename Kudu test and override missing test method Static inner test classes that did not follow the BaseConnectorTest naming convention were not being run. Rename tests to follow the naming convention and then fix the test error that was previously hidden --- ...uWithStandardInferSchemaConnectorTest.java | 19 +++++++++++++++++++ ...mokeTests.java => KuduConnectorTests.java} | 4 ++-- .../plugin/kudu/KuduLatestConnectorTests.java | 2 +- 3 files changed, 22 insertions(+), 3 deletions(-) rename plugin/trino-kudu/src/test/java/io/trino/plugin/kudu/{KuduSmokeTests.java => KuduConnectorTests.java} (93%) diff --git a/plugin/trino-kudu/src/test/java/io/trino/plugin/kudu/AbstractKuduWithStandardInferSchemaConnectorTest.java b/plugin/trino-kudu/src/test/java/io/trino/plugin/kudu/AbstractKuduWithStandardInferSchemaConnectorTest.java index b8f49b4fe811..6e44ec4fdad8 100644 --- a/plugin/trino-kudu/src/test/java/io/trino/plugin/kudu/AbstractKuduWithStandardInferSchemaConnectorTest.java +++ b/plugin/trino-kudu/src/test/java/io/trino/plugin/kudu/AbstractKuduWithStandardInferSchemaConnectorTest.java @@ -17,6 +17,7 @@ import java.util.Optional; +import static io.trino.testing.sql.TestTable.randomTableSuffix; import static org.testng.Assert.assertEquals; public abstract class AbstractKuduWithStandardInferSchemaConnectorTest @@ -33,4 +34,22 @@ public void testListingOfTableForDefaultSchema() { assertEquals(computeActual("SHOW TABLES FROM default").getRowCount(), 0); } + + @Test + @Override + public void testDropNonEmptySchema() + { + // Set column and table properties in CREATE TABLE statement + String schemaName = "test_drop_non_empty_schema_" + randomTableSuffix(); + + try { + assertUpdate("CREATE SCHEMA " + schemaName); + assertUpdate("CREATE TABLE " + schemaName + ".t(x int WITH (primary_key=true)) WITH (partition_by_hash_columns=ARRAY['x'], partition_by_hash_buckets=2)"); + assertQueryFails("DROP SCHEMA " + schemaName, ".*Cannot drop non-empty schema '\\Q" + schemaName + "\\E'"); + } + finally { + assertUpdate("DROP TABLE IF EXISTS " + schemaName + ".t"); + assertUpdate("DROP SCHEMA IF EXISTS " + schemaName); + } + } } diff --git a/plugin/trino-kudu/src/test/java/io/trino/plugin/kudu/KuduSmokeTests.java b/plugin/trino-kudu/src/test/java/io/trino/plugin/kudu/KuduConnectorTests.java similarity index 93% rename from plugin/trino-kudu/src/test/java/io/trino/plugin/kudu/KuduSmokeTests.java rename to plugin/trino-kudu/src/test/java/io/trino/plugin/kudu/KuduConnectorTests.java index b7c92c325a7f..eb0c12faacf8 100644 --- a/plugin/trino-kudu/src/test/java/io/trino/plugin/kudu/KuduSmokeTests.java +++ b/plugin/trino-kudu/src/test/java/io/trino/plugin/kudu/KuduConnectorTests.java @@ -13,7 +13,7 @@ */ package io.trino.plugin.kudu; -public class KuduSmokeTests +public class KuduConnectorTests { private static final String KUDU_VERSION = "1.13.0"; @@ -37,7 +37,7 @@ protected String getKuduServerVersion() } } - public static class TestKuduSmokeTestWithStandardInferSchema + public static class TestKuduWithStandardInferSchemaConnectorTest extends AbstractKuduWithStandardInferSchemaConnectorTest { @Override diff --git a/plugin/trino-kudu/src/test/java/io/trino/plugin/kudu/KuduLatestConnectorTests.java b/plugin/trino-kudu/src/test/java/io/trino/plugin/kudu/KuduLatestConnectorTests.java index 88d09e72e81d..8977dbcae834 100644 --- a/plugin/trino-kudu/src/test/java/io/trino/plugin/kudu/KuduLatestConnectorTests.java +++ b/plugin/trino-kudu/src/test/java/io/trino/plugin/kudu/KuduLatestConnectorTests.java @@ -37,7 +37,7 @@ protected String getKuduServerVersion() } } - public static class TestKuduSmokeTestWithStandardInferSchema + public static class TestKuduWithStandardInferSchemaConnectorTest extends AbstractKuduWithStandardInferSchemaConnectorTest { @Override