From a20b7b5e224a72509dfce7b60772e4b0591f16d7 Mon Sep 17 00:00:00 2001 From: "Mateusz \"Serafin\" Gajewski" Date: Thu, 30 Jan 2025 20:39:27 +0100 Subject: [PATCH] Reenable Snowflake tests This reverts commit 5c431491f93bc1a5c82d4780aa8220d48236eac2 and applies necessary fixes to the changes that were introduced in the meantime. --- .github/workflows/ci.yml | 1 + ...ergSnowflakeCatalogConnectorSmokeTest.java | 4 +--- .../snowflake/TestTrinoSnowflakeCatalog.java | 2 -- .../snowflake/TestSnowflakeConnectorTest.java | 1 - .../snowflake/TestSnowflakeTypeMapping.java | 20 +++++++++---------- 5 files changed, 11 insertions(+), 17 deletions(-) diff --git a/.github/workflows/ci.yml b/.github/workflows/ci.yml index 74acf763d02a..e1abf3cc93a2 100644 --- a/.github/workflows/ci.yml +++ b/.github/workflows/ci.yml @@ -907,6 +907,7 @@ jobs: - suite-clickhouse - suite-mysql - suite-iceberg + - suite-snowflake - suite-hudi - suite-ignite exclude: diff --git a/plugin/trino-iceberg/src/test/java/io/trino/plugin/iceberg/catalog/snowflake/TestIcebergSnowflakeCatalogConnectorSmokeTest.java b/plugin/trino-iceberg/src/test/java/io/trino/plugin/iceberg/catalog/snowflake/TestIcebergSnowflakeCatalogConnectorSmokeTest.java index 51e67a18d578..6ca4fbf101c7 100644 --- a/plugin/trino-iceberg/src/test/java/io/trino/plugin/iceberg/catalog/snowflake/TestIcebergSnowflakeCatalogConnectorSmokeTest.java +++ b/plugin/trino-iceberg/src/test/java/io/trino/plugin/iceberg/catalog/snowflake/TestIcebergSnowflakeCatalogConnectorSmokeTest.java @@ -22,7 +22,6 @@ import io.trino.testing.QueryRunner; import io.trino.testing.TestingConnectorBehavior; import io.trino.tpch.TpchTable; -import org.junit.jupiter.api.Disabled; import org.junit.jupiter.api.Test; import org.junit.jupiter.api.TestInstance; @@ -44,7 +43,6 @@ import static org.junit.jupiter.api.TestInstance.Lifecycle.PER_CLASS; @TestInstance(PER_CLASS) -@Disabled("Temporary disabled due to lack of payment for the Snowflake account") public class TestIcebergSnowflakeCatalogConnectorSmokeTest extends BaseIcebergConnectorSmokeTest { @@ -612,7 +610,7 @@ public void testListViews() public void testExecuteDelete() { assertThatThrownBy(() -> assertUpdate("DELETE FROM " + TpchTable.REGION.getTableName())) - .hasMessageMatching("Failed to close manifest writer"); + .hasMessageContaining("Failed to close manifest writer"); } @Test diff --git a/plugin/trino-iceberg/src/test/java/org/apache/iceberg/snowflake/TestTrinoSnowflakeCatalog.java b/plugin/trino-iceberg/src/test/java/org/apache/iceberg/snowflake/TestTrinoSnowflakeCatalog.java index 6495c5297917..936c3e251342 100644 --- a/plugin/trino-iceberg/src/test/java/org/apache/iceberg/snowflake/TestTrinoSnowflakeCatalog.java +++ b/plugin/trino-iceberg/src/test/java/org/apache/iceberg/snowflake/TestTrinoSnowflakeCatalog.java @@ -50,7 +50,6 @@ import org.apache.iceberg.jdbc.JdbcClientPool; import org.apache.iceberg.types.Types; import org.junit.jupiter.api.BeforeAll; -import org.junit.jupiter.api.Disabled; import org.junit.jupiter.api.Test; import java.net.URI; @@ -82,7 +81,6 @@ import static org.assertj.core.api.Assertions.assertThat; import static org.assertj.core.api.Assertions.assertThatThrownBy; -@Disabled("Temporary disabled due to lack of payment for the Snowflake account") public class TestTrinoSnowflakeCatalog extends BaseTrinoCatalogTest { diff --git a/plugin/trino-snowflake/src/test/java/io/trino/plugin/snowflake/TestSnowflakeConnectorTest.java b/plugin/trino-snowflake/src/test/java/io/trino/plugin/snowflake/TestSnowflakeConnectorTest.java index c5c9eaf7bc54..2461b907182f 100644 --- a/plugin/trino-snowflake/src/test/java/io/trino/plugin/snowflake/TestSnowflakeConnectorTest.java +++ b/plugin/trino-snowflake/src/test/java/io/trino/plugin/snowflake/TestSnowflakeConnectorTest.java @@ -44,7 +44,6 @@ @TestInstance(PER_CLASS) @Execution(CONCURRENT) -@Disabled("Temporary disabled due to lack of payment for the Snowflake account") public class TestSnowflakeConnectorTest extends BaseJdbcConnectorTest { diff --git a/plugin/trino-snowflake/src/test/java/io/trino/plugin/snowflake/TestSnowflakeTypeMapping.java b/plugin/trino-snowflake/src/test/java/io/trino/plugin/snowflake/TestSnowflakeTypeMapping.java index 3a4a6f035a5e..37abda9255e4 100644 --- a/plugin/trino-snowflake/src/test/java/io/trino/plugin/snowflake/TestSnowflakeTypeMapping.java +++ b/plugin/trino-snowflake/src/test/java/io/trino/plugin/snowflake/TestSnowflakeTypeMapping.java @@ -26,7 +26,6 @@ import io.trino.testing.sql.TestTable; import io.trino.testing.sql.TrinoSqlExecutor; import org.junit.jupiter.api.BeforeAll; -import org.junit.jupiter.api.Disabled; import org.junit.jupiter.api.Test; import org.junit.jupiter.api.TestInstance; import org.junit.jupiter.api.parallel.Execution; @@ -54,21 +53,20 @@ @TestInstance(PER_CLASS) @Execution(CONCURRENT) -@Disabled("Temporary disabled due to lack of payment for the Snowflake account") public class TestSnowflakeTypeMapping extends AbstractTestQueryFramework { private final ZoneId jvmZone = ZoneId.systemDefault(); // no DST in 1970, but has DST in later years (e.g. 2018) private final ZoneId vilnius = ZoneId.of("Europe/Vilnius"); - // minutes offset change since 1970-01-01, no DST + // minutes offset change since 1932-04-01, no DST private final ZoneId kathmandu = ZoneId.of("Asia/Kathmandu"); @BeforeAll public void setUp() { checkState(jvmZone.getId().equals("America/Bahia_Banderas"), "Timezone not configured correctly. Add -Duser.timezone=America/Bahia_Banderas to your JVM arguments"); - checkIsGap(jvmZone, LocalDate.of(1970, 1, 1)); + checkIsGap(jvmZone, LocalDate.of(1932, 4, 1)); checkIsGap(vilnius, LocalDate.of(1983, 4, 1)); verify(vilnius.getRules().getValidOffsets(LocalDate.of(1983, 10, 1).atStartOfDay().minusMinutes(1)).size() == 2); } @@ -371,7 +369,7 @@ private void testTimestamp(ZoneId sessionZone) .addRoundTrip("timestamp(3)", "TIMESTAMP '2018-10-28 01:33:17.456'", createTimestampType(3), "TIMESTAMP '2018-10-28 01:33:17.456'") // time double in Vilnius .addRoundTrip("timestamp(3)", "TIMESTAMP '2018-10-28 03:33:33.333'", createTimestampType(3), "TIMESTAMP '2018-10-28 03:33:33.333'") - .addRoundTrip("timestamp(3)", "TIMESTAMP '1970-01-01 00:13:42.000'", createTimestampType(3), "TIMESTAMP '1970-01-01 00:13:42.000'") + .addRoundTrip("timestamp(3)", "TIMESTAMP '1932-04-01 00:13:42.000'", createTimestampType(3), "TIMESTAMP '1932-04-01 00:13:42.000'") .addRoundTrip("timestamp(3)", "TIMESTAMP '2018-04-01 02:13:55.123'", createTimestampType(3), "TIMESTAMP '2018-04-01 02:13:55.123'") // time gap in Vilnius .addRoundTrip("timestamp(3)", "TIMESTAMP '2018-03-25 03:17:17.000'", createTimestampType(3), "TIMESTAMP '2018-03-25 03:17:17.000'") @@ -380,12 +378,12 @@ private void testTimestamp(ZoneId sessionZone) // max value 2038-01-19 03:14:07 .addRoundTrip("timestamp(3)", "TIMESTAMP '2038-01-19 03:14:07.000'", createTimestampType(3), "TIMESTAMP '2038-01-19 03:14:07.000'") // test arbitrary time for all supported precisions - .addRoundTrip("timestamp(0)", "TIMESTAMP '1970-01-01 00:00:01'", createTimestampType(0), "TIMESTAMP '1970-01-01 00:00:01'") - .addRoundTrip("timestamp(1)", "TIMESTAMP '1970-01-01 00:00:01.1'", createTimestampType(1), "TIMESTAMP '1970-01-01 00:00:01.1'") - .addRoundTrip("timestamp(1)", "TIMESTAMP '1970-01-01 00:00:01.9'", createTimestampType(1), "TIMESTAMP '1970-01-01 00:00:01.9'") - .addRoundTrip("timestamp(2)", "TIMESTAMP '1970-01-01 00:00:01.12'", createTimestampType(2), "TIMESTAMP '1970-01-01 00:00:01.12'") - .addRoundTrip("timestamp(3)", "TIMESTAMP '1970-01-01 00:00:01.123'", createTimestampType(3), "TIMESTAMP '1970-01-01 00:00:01.123'") - .addRoundTrip("timestamp(3)", "TIMESTAMP '1970-01-01 00:00:01.999'", createTimestampType(3), "TIMESTAMP '1970-01-01 00:00:01.999'") + .addRoundTrip("timestamp(0)", "TIMESTAMP '1932-04-01 00:00:01'", createTimestampType(0), "TIMESTAMP '1932-04-01 00:00:01'") + .addRoundTrip("timestamp(1)", "TIMESTAMP '1932-04-01 00:00:01.1'", createTimestampType(1), "TIMESTAMP '1932-04-01 00:00:01.1'") + .addRoundTrip("timestamp(1)", "TIMESTAMP '1932-04-01 00:00:01.9'", createTimestampType(1), "TIMESTAMP '1932-04-01 00:00:01.9'") + .addRoundTrip("timestamp(2)", "TIMESTAMP '1932-04-01 00:00:01.12'", createTimestampType(2), "TIMESTAMP '1932-04-01 00:00:01.12'") + .addRoundTrip("timestamp(3)", "TIMESTAMP '1932-04-01 00:00:01.123'", createTimestampType(3), "TIMESTAMP '1932-04-01 00:00:01.123'") + .addRoundTrip("timestamp(3)", "TIMESTAMP '1932-04-01 00:00:01.999'", createTimestampType(3), "TIMESTAMP '1932-04-01 00:00:01.999'") .addRoundTrip("timestamp(1)", "TIMESTAMP '2020-09-27 12:34:56.1'", createTimestampType(1), "TIMESTAMP '2020-09-27 12:34:56.1'") .addRoundTrip("timestamp(1)", "TIMESTAMP '2020-09-27 12:34:56.9'", createTimestampType(1), "TIMESTAMP '2020-09-27 12:34:56.9'") .addRoundTrip("timestamp(3)", "TIMESTAMP '2020-09-27 12:34:56.123'", createTimestampType(3), "TIMESTAMP '2020-09-27 12:34:56.123'")