From 84d3deae75de45b97b5e2602902f0a88f0cfd84b Mon Sep 17 00:00:00 2001 From: Yuya Ebihara Date: Thu, 25 Apr 2024 08:24:50 +0900 Subject: [PATCH] Fix flaky TestCassandraConnectorTest --- .../plugin/cassandra/TestCassandraConnectorTest.java | 12 ++++++++++++ 1 file changed, 12 insertions(+) diff --git a/plugin/trino-cassandra/src/test/java/io/trino/plugin/cassandra/TestCassandraConnectorTest.java b/plugin/trino-cassandra/src/test/java/io/trino/plugin/cassandra/TestCassandraConnectorTest.java index df7e945579ea..75cc1e33e90f 100644 --- a/plugin/trino-cassandra/src/test/java/io/trino/plugin/cassandra/TestCassandraConnectorTest.java +++ b/plugin/trino-cassandra/src/test/java/io/trino/plugin/cassandra/TestCassandraConnectorTest.java @@ -222,6 +222,13 @@ public void testCharVarcharComparison() .hasMessage("Unsupported type: char(3)"); } + @Test + @Override // Override because some tests (e.g. testKeyspaceNameAmbiguity) cause table listing failure + public void testShowInformationSchemaTables() + { + executeExclusively(super::testShowInformationSchemaTables); + } + @Test @Override // Override because some tests (e.g. testKeyspaceNameAmbiguity, testNativeQueryCaseSensitivity) cause column listing failure public void testSelectInformationSchemaColumns() @@ -958,6 +965,9 @@ public void testKeyspaceNameAmbiguity() session.execute("DROP KEYSPACE \"KeYsPaCe_3\""); session.execute("DROP KEYSPACE \"kEySpAcE_3\""); + // Wait until the schema becomes invisible to Trino. Otherwise, testSelectInformationSchemaColumns may fail due to ambiguous schema names. + assertEventually(() -> assertThat(computeActual("SHOW SCHEMAS FROM cassandra").getOnlyColumnAsSet()) + .doesNotContain("keyspace_3")); } @Test @@ -1479,6 +1489,8 @@ public void testNativeQueryCaseSensitivity() "VALUES (1, 2)"); onCassandra("DROP TABLE tpch." + tableName); + // Wait until the table becomes invisible to Trino. Otherwise, testSelectInformationSchemaColumns may fail due to ambiguous column names. + assertEventually(() -> assertThat(getQueryRunner().tableExists(getSession(), tableName)).isFalse()); } @Test