From 60e2196ec29b317e658fa911d4a2405572b148f4 Mon Sep 17 00:00:00 2001 From: Piotr Findeisen Date: Tue, 27 Sep 2022 19:17:12 +0200 Subject: [PATCH 1/3] Use meaningful table name in CLI product test --- .../java/io/trino/tests/product/cli/TestTrinoCli.java | 8 ++++---- 1 file changed, 4 insertions(+), 4 deletions(-) diff --git a/testing/trino-product-tests/src/main/java/io/trino/tests/product/cli/TestTrinoCli.java b/testing/trino-product-tests/src/main/java/io/trino/tests/product/cli/TestTrinoCli.java index c77b270de0c3..6d9428293cd7 100644 --- a/testing/trino-product-tests/src/main/java/io/trino/tests/product/cli/TestTrinoCli.java +++ b/testing/trino-product-tests/src/main/java/io/trino/tests/product/cli/TestTrinoCli.java @@ -409,20 +409,20 @@ public void shouldPrintExplainAnalyzePlan() { launchTrinoCliWithServerArgument(); trino.waitForPrompt(); - trino.getProcessInput().println("EXPLAIN ANALYZE CREATE TABLE iceberg.default.test_table AS SELECT * FROM hive.default.nation LIMIT 10;"); + trino.getProcessInput().println("EXPLAIN ANALYZE CREATE TABLE iceberg.default.test_print_explain_analyze AS SELECT * FROM hive.default.nation LIMIT 10;"); List lines = trimLines(trino.readLinesUntilPrompt()); // TODO once https://github.com/trinodb/trino/issues/14253 is done this should be assertThat(lines).contains("CREATE TABLE: 1 row", "Query Plan"); assertThat(lines).contains("CREATE TABLE", "Query Plan"); // TODO once https://github.com/trinodb/trino/issues/14253 is done this should be assertThat(lines).contains("INSERT: 1 row", "Query Plan"); - trino.getProcessInput().println("EXPLAIN ANALYZE INSERT INTO iceberg.default.test_table VALUES(100, 'URUGUAY', 3, 'test comment');"); + trino.getProcessInput().println("EXPLAIN ANALYZE INSERT INTO iceberg.default.test_print_explain_analyze VALUES(100, 'URUGUAY', 3, 'test comment');"); lines = trimLines(trino.readLinesUntilPrompt()); assertThat(lines).contains("INSERT", "Query Plan"); // TODO once https://github.com/trinodb/trino/issues/14253 is done this should be assertThat(lines).contains("UPDATE: 1 row", "Query Plan"); - trino.getProcessInput().println("EXPLAIN ANALYZE UPDATE iceberg.default.test_table SET n_comment = 'testValue 5' WHERE n_nationkey = 100;"); + trino.getProcessInput().println("EXPLAIN ANALYZE UPDATE iceberg.default.test_print_explain_analyze SET n_comment = 'testValue 5' WHERE n_nationkey = 100;"); lines = trimLines(trino.readLinesUntilPrompt()); assertThat(lines).contains("UPDATE", "Query Plan"); // TODO once https://github.com/trinodb/trino/issues/14253 is done this should be assertThat(lines).contains("DELETE: 1 row", "Query Plan"); - trino.getProcessInput().println("EXPLAIN ANALYZE DELETE FROM iceberg.default.test_table WHERE n_nationkey = 100;"); + trino.getProcessInput().println("EXPLAIN ANALYZE DELETE FROM iceberg.default.test_print_explain_analyze WHERE n_nationkey = 100;"); lines = trimLines(trino.readLinesUntilPrompt()); assertThat(lines).contains("DELETE", "Query Plan"); } From 0c2db7ecd01010a2c1771b128a6b367e69031324 Mon Sep 17 00:00:00 2001 From: Piotr Findeisen Date: Tue, 27 Sep 2022 19:19:10 +0200 Subject: [PATCH 2/3] Update method name referring to Presto --- .../main/java/io/trino/tests/product/cli/TestTrinoCli.java | 4 ++-- .../java/io/trino/tests/product/cli/TestTrinoLdapCli.java | 4 ++-- .../java/io/trino/tests/product/cli/TrinoCliLauncher.java | 2 +- 3 files changed, 5 insertions(+), 5 deletions(-) diff --git a/testing/trino-product-tests/src/main/java/io/trino/tests/product/cli/TestTrinoCli.java b/testing/trino-product-tests/src/main/java/io/trino/tests/product/cli/TestTrinoCli.java index 6d9428293cd7..14cae6d9467b 100644 --- a/testing/trino-product-tests/src/main/java/io/trino/tests/product/cli/TestTrinoCli.java +++ b/testing/trino-product-tests/src/main/java/io/trino/tests/product/cli/TestTrinoCli.java @@ -96,10 +96,10 @@ public TestTrinoCli() @AfterTestWithContext @Override - public void stopPresto() + public void stopCli() throws InterruptedException { - super.stopPresto(); + super.stopCli(); } @Override diff --git a/testing/trino-product-tests/src/main/java/io/trino/tests/product/cli/TestTrinoLdapCli.java b/testing/trino-product-tests/src/main/java/io/trino/tests/product/cli/TestTrinoLdapCli.java index f3f96a97b1a6..795bb82d03ed 100644 --- a/testing/trino-product-tests/src/main/java/io/trino/tests/product/cli/TestTrinoLdapCli.java +++ b/testing/trino-product-tests/src/main/java/io/trino/tests/product/cli/TestTrinoLdapCli.java @@ -95,10 +95,10 @@ public TestTrinoLdapCli() @AfterTestWithContext @Override - public void stopPresto() + public void stopCli() throws InterruptedException { - super.stopPresto(); + super.stopCli(); } @Override diff --git a/testing/trino-product-tests/src/main/java/io/trino/tests/product/cli/TrinoCliLauncher.java b/testing/trino-product-tests/src/main/java/io/trino/tests/product/cli/TrinoCliLauncher.java index e8fbed670779..bfc68ec663ed 100644 --- a/testing/trino-product-tests/src/main/java/io/trino/tests/product/cli/TrinoCliLauncher.java +++ b/testing/trino-product-tests/src/main/java/io/trino/tests/product/cli/TrinoCliLauncher.java @@ -53,7 +53,7 @@ protected TrinoCliLauncher() nationTableBatchLines = readLines(getResource("io/trino/tests/product/cli/batch_query.results"), UTF_8); } - protected void stopPresto() + protected void stopCli() throws InterruptedException { if (trino != null) { From 2eb96a0ddfca6372b1dcfad74513fe12e5133f1e Mon Sep 17 00:00:00 2001 From: Piotr Findeisen Date: Tue, 27 Sep 2022 19:20:01 +0200 Subject: [PATCH 3/3] Cleanup test table in CLI product test If the table is left over, causes failure of `TestRoles`. `TestRoles` should not assume there are no Iceberg tables in the metastore, so this should be viewed as a quick-fix only. --- .../main/java/io/trino/tests/product/cli/TestTrinoCli.java | 4 ++++ 1 file changed, 4 insertions(+) diff --git a/testing/trino-product-tests/src/main/java/io/trino/tests/product/cli/TestTrinoCli.java b/testing/trino-product-tests/src/main/java/io/trino/tests/product/cli/TestTrinoCli.java index 14cae6d9467b..cf0426bf3c09 100644 --- a/testing/trino-product-tests/src/main/java/io/trino/tests/product/cli/TestTrinoCli.java +++ b/testing/trino-product-tests/src/main/java/io/trino/tests/product/cli/TestTrinoCli.java @@ -40,6 +40,7 @@ import static io.trino.tests.product.TestGroups.AUTHORIZATION; import static io.trino.tests.product.TestGroups.CLI; import static io.trino.tests.product.TestGroups.PROFILE_SPECIFIC_TESTS; +import static io.trino.tests.product.utils.QueryExecutors.onTrino; import static java.lang.String.format; import static java.nio.charset.StandardCharsets.UTF_8; import static java.nio.file.Files.writeString; @@ -425,6 +426,9 @@ public void shouldPrintExplainAnalyzePlan() trino.getProcessInput().println("EXPLAIN ANALYZE DELETE FROM iceberg.default.test_print_explain_analyze WHERE n_nationkey = 100;"); lines = trimLines(trino.readLinesUntilPrompt()); assertThat(lines).contains("DELETE", "Query Plan"); + + // cleanup + onTrino().executeQuery("DROP TABLE iceberg.default.test_print_explain_analyze"); } private void launchTrinoCliWithServerArgument(String... arguments)