From 34168703d94d49533e7e15465eaa8a47b00e95af Mon Sep 17 00:00:00 2001 From: Yuya Ebihara Date: Thu, 26 Dec 2024 22:12:38 +0900 Subject: [PATCH] Rename to Trino in product tests --- .../trino/tests/product/cli/TestTrinoCli.java | 4 +- .../tests/product/cli/TestTrinoLdapCli.java | 8 +- ...aLakeCreateTableAsSelectCompatibility.java | 12 +- .../TestDeltaLakeUpdateCompatibility.java | 16 +- .../product/hive/AbstractTestHiveViews.java | 4 +- .../product/hive/BaseTestHiveCoercion.java | 12 +- .../tests/product/hive/TestAvroSchemaUrl.java | 16 +- .../tests/product/hive/TestGrantRevoke.java | 2 +- .../hive/TestHiveBasicTableStatistics.java | 16 +- .../product/hive/TestHiveTableStatistics.java | 4 +- .../product/hive/TestHiveViewsLegacy.java | 2 +- .../trino/tests/product/hive/TestRoles.java | 240 +++++++++--------- .../tests/product/jdbc/BaseLdapJdbcTest.java | 10 +- .../tests/product/jdbc/TestLdapTrinoJdbc.java | 4 +- 14 files changed, 175 insertions(+), 175 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 836aba8a92da..715573f254b3 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 @@ -113,10 +113,10 @@ public void shouldDisplayVersion() throws IOException { launchTrinoCli("--version"); - assertThat(trino.readRemainingOutputLines()).containsExactly("Trino CLI " + readPrestoCliVersion()); + assertThat(trino.readRemainingOutputLines()).containsExactly("Trino CLI " + readTrinoCliVersion()); } - private static String readPrestoCliVersion() + private static String readTrinoCliVersion() { try { String version = Resources.toString(Resources.getResource("trino-cli-version.txt"), UTF_8).trim(); 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 e30ea63db6d4..a647e87e2a3f 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 @@ -313,16 +313,16 @@ private void launchTrinoCliWithServerArgument(String... arguments) requireNonNull(ldapServerAddress, "ldapServerAddress is null"); requireNonNull(ldapUserPassword, "ldapUserPassword is null"); - ImmutableList.Builder prestoClientOptions = ImmutableList.builder(); - prestoClientOptions.add( + ImmutableList.Builder trinoClientOptions = ImmutableList.builder(); + trinoClientOptions.add( "--server", ldapServerAddress, "--truststore-path", ldapTruststorePath, "--truststore-password", ldapTruststorePassword, "--user", ldapUserName, "--password"); - prestoClientOptions.add(arguments); - ProcessBuilder processBuilder = getProcessBuilder(prestoClientOptions.build()); + trinoClientOptions.add(arguments); + ProcessBuilder processBuilder = getProcessBuilder(trinoClientOptions.build()); processBuilder.environment().put("TRINO_PASSWORD", ldapUserPassword); trino = new TrinoCliProcess(processBuilder.start()); } diff --git a/testing/trino-product-tests/src/main/java/io/trino/tests/product/deltalake/TestDeltaLakeCreateTableAsSelectCompatibility.java b/testing/trino-product-tests/src/main/java/io/trino/tests/product/deltalake/TestDeltaLakeCreateTableAsSelectCompatibility.java index 6dec47308100..a6845c3492f5 100644 --- a/testing/trino-product-tests/src/main/java/io/trino/tests/product/deltalake/TestDeltaLakeCreateTableAsSelectCompatibility.java +++ b/testing/trino-product-tests/src/main/java/io/trino/tests/product/deltalake/TestDeltaLakeCreateTableAsSelectCompatibility.java @@ -45,7 +45,7 @@ public class TestDeltaLakeCreateTableAsSelectCompatibility { @Test(groups = {DELTA_LAKE_DATABRICKS, DELTA_LAKE_DATABRICKS_113, DELTA_LAKE_DATABRICKS_122, DELTA_LAKE_DATABRICKS_133, DELTA_LAKE_DATABRICKS_143, PROFILE_SPECIFIC_TESTS}) @Flaky(issue = DATABRICKS_COMMUNICATION_FAILURE_ISSUE, match = DATABRICKS_COMMUNICATION_FAILURE_MATCH) - public void testPrestoTypesWithDatabricks() + public void testTrinoTypesWithDatabricks() { String tableName = "test_dl_ctas_" + randomNameSuffix(); @@ -63,8 +63,8 @@ public void testPrestoTypesWithDatabricks() .containsOnly(row(7)); QueryResult databricksResult = onDelta().executeQuery(format("SELECT * FROM default.%s", tableName)); - QueryResult prestoResult = onTrino().executeQuery(format("SELECT * FROM delta.default.\"%s\"", tableName)); - assertThat(databricksResult).containsOnly(prestoResult.rows().stream() + QueryResult trinoResult = onTrino().executeQuery(format("SELECT * FROM delta.default.\"%s\"", tableName)); + assertThat(databricksResult).containsOnly(trinoResult.rows().stream() .map(QueryAssert.Row::new) .collect(toImmutableList())); } @@ -75,7 +75,7 @@ public void testPrestoTypesWithDatabricks() @Test(groups = {DELTA_LAKE_DATABRICKS, PROFILE_SPECIFIC_TESTS}) @Flaky(issue = DATABRICKS_COMMUNICATION_FAILURE_ISSUE, match = DATABRICKS_COMMUNICATION_FAILURE_MATCH) - public void testPrestoTimestampsWithDatabricks() + public void testTrinoTimestampsWithDatabricks() { String tableName = "test_dl_ctas_timestamps_" + randomNameSuffix(); @@ -90,8 +90,8 @@ public void testPrestoTimestampsWithDatabricks() .containsOnly(row(4)); QueryResult databricksResult = onDelta().executeQuery("SELECT id, date_format(timestamp_in_utc, \"yyyy-MM-dd HH:mm:ss.SSS\"), date_format(timestamp_in_new_york, \"yyyy-MM-dd HH:mm:ss.SSS\"), date_format(timestamp_in_warsaw, \"yyyy-MM-dd HH:mm:ss.SSS\") FROM default." + tableName); - QueryResult prestoResult = onTrino().executeQuery("SELECT id, format('%1$tF %1$tT.%1$tL', timestamp_in_utc), format('%1$tF %1$tT.%1$tL', timestamp_in_new_york), format('%1$tF %1$tT.%1$tL', timestamp_in_warsaw) FROM delta.default.\"" + tableName + "\""); - assertThat(databricksResult).containsOnly(prestoResult.rows().stream() + QueryResult trinoResult = onTrino().executeQuery("SELECT id, format('%1$tF %1$tT.%1$tL', timestamp_in_utc), format('%1$tF %1$tT.%1$tL', timestamp_in_new_york), format('%1$tF %1$tT.%1$tL', timestamp_in_warsaw) FROM delta.default.\"" + tableName + "\""); + assertThat(databricksResult).containsOnly(trinoResult.rows().stream() .map(QueryAssert.Row::new) .collect(toImmutableList())); } diff --git a/testing/trino-product-tests/src/main/java/io/trino/tests/product/deltalake/TestDeltaLakeUpdateCompatibility.java b/testing/trino-product-tests/src/main/java/io/trino/tests/product/deltalake/TestDeltaLakeUpdateCompatibility.java index 37ebaaa6e6bd..918507de550e 100644 --- a/testing/trino-product-tests/src/main/java/io/trino/tests/product/deltalake/TestDeltaLakeUpdateCompatibility.java +++ b/testing/trino-product-tests/src/main/java/io/trino/tests/product/deltalake/TestDeltaLakeUpdateCompatibility.java @@ -54,23 +54,23 @@ public void testUpdatesFromDatabricks() try { QueryResult databricksResult = onDelta().executeQuery(format("SELECT * FROM default.%s ORDER BY id", tableName)); - QueryResult prestoResult = onTrino().executeQuery(format("SELECT * FROM delta.default.\"%s\" ORDER BY id", tableName)); - assertThat(databricksResult).containsExactlyInOrder(toRows(prestoResult)); + QueryResult trinoResult = onTrino().executeQuery(format("SELECT * FROM delta.default.\"%s\" ORDER BY id", tableName)); + assertThat(databricksResult).containsExactlyInOrder(toRows(trinoResult)); onDelta().executeQuery(format("UPDATE default.%s SET value = 'France' WHERE id = 2", tableName)); databricksResult = onDelta().executeQuery(format("SELECT * FROM default.%s ORDER BY id", tableName)); - prestoResult = onTrino().executeQuery(format("SELECT * FROM delta.default.\"%s\" ORDER BY id", tableName)); - assertThat(databricksResult).containsExactlyInOrder(toRows(prestoResult)); + trinoResult = onTrino().executeQuery(format("SELECT * FROM delta.default.\"%s\" ORDER BY id", tableName)); + assertThat(databricksResult).containsExactlyInOrder(toRows(trinoResult)); onDelta().executeQuery(format("UPDATE default.%s SET value = 'Spain' WHERE id = 2", tableName)); databricksResult = onDelta().executeQuery(format("SELECT * FROM default.%s ORDER BY id", tableName)); - prestoResult = onTrino().executeQuery(format("SELECT * FROM delta.default.\"%s\" ORDER BY id", tableName)); - assertThat(databricksResult).containsExactlyInOrder(toRows(prestoResult)); + trinoResult = onTrino().executeQuery(format("SELECT * FROM delta.default.\"%s\" ORDER BY id", tableName)); + assertThat(databricksResult).containsExactlyInOrder(toRows(trinoResult)); onDelta().executeQuery(format("UPDATE default.%s SET value = 'Portugal' WHERE id = 2", tableName)); databricksResult = onDelta().executeQuery(format("SELECT * FROM default.%s ORDER BY id", tableName)); - prestoResult = onTrino().executeQuery(format("SELECT * FROM delta.default.\"%s\" ORDER BY id", tableName)); - assertThat(databricksResult).containsExactlyInOrder(toRows(prestoResult)); + trinoResult = onTrino().executeQuery(format("SELECT * FROM delta.default.\"%s\" ORDER BY id", tableName)); + assertThat(databricksResult).containsExactlyInOrder(toRows(trinoResult)); } finally { dropDeltaTableWithRetry("default." + tableName); diff --git a/testing/trino-product-tests/src/main/java/io/trino/tests/product/hive/AbstractTestHiveViews.java b/testing/trino-product-tests/src/main/java/io/trino/tests/product/hive/AbstractTestHiveViews.java index 88a8c224f943..73173dc63053 100644 --- a/testing/trino-product-tests/src/main/java/io/trino/tests/product/hive/AbstractTestHiveViews.java +++ b/testing/trino-product-tests/src/main/java/io/trino/tests/product/hive/AbstractTestHiveViews.java @@ -81,7 +81,7 @@ public void testArrayIndexingInView() { onHive().executeQuery("DROP TABLE IF EXISTS test_hive_view_array_index_table"); onHive().executeQuery("CREATE TABLE test_hive_view_array_index_table(an_index int, an_array array)"); - onHive().executeQuery("INSERT INTO TABLE test_hive_view_array_index_table SELECT 1, array('presto','hive') FROM nation WHERE n_nationkey = 1"); + onHive().executeQuery("INSERT INTO TABLE test_hive_view_array_index_table SELECT 1, array('trino','hive') FROM nation WHERE n_nationkey = 1"); // literal array index onHive().executeQuery("DROP VIEW IF EXISTS test_hive_view_array_index_view"); @@ -761,7 +761,7 @@ public void testRunAsInvoker() protected static void assertViewQuery(String query, Consumer assertion) { - // Ensure Hive and Presto view compatibility by comparing the results + // Ensure Hive and Trino view compatibility by comparing the results assertion.accept(assertThat(onHive().executeQuery(query))); assertion.accept(assertThat(onTrino().executeQuery(query))); } diff --git a/testing/trino-product-tests/src/main/java/io/trino/tests/product/hive/BaseTestHiveCoercion.java b/testing/trino-product-tests/src/main/java/io/trino/tests/product/hive/BaseTestHiveCoercion.java index 9745a3dc051d..7f6d3cc1b18d 100644 --- a/testing/trino-product-tests/src/main/java/io/trino/tests/product/hive/BaseTestHiveCoercion.java +++ b/testing/trino-product-tests/src/main/java/io/trino/tests/product/hive/BaseTestHiveCoercion.java @@ -203,17 +203,17 @@ protected void doTestHiveCoercion(HiveTableDefinition tableDefinition) Function>> expected = engine -> expectedValuesForEngineProvider(engine, tableName, booleanToVarcharVal); // For Trino, remove unsupported columns - List prestoReadColumns = removeUnsupportedColumnsForTrino(allColumns, tableName); - Map> expectedPrestoResults = expected.apply(Engine.TRINO); + List trinoReadColumns = removeUnsupportedColumnsForTrino(allColumns, tableName); + Map> expectedTrinoResults = expected.apply(Engine.TRINO); // In case of unpartitioned tables we don't support all the column coercion thereby making this assertion conditional if (expectedExceptionsWithTrinoContext().isEmpty()) { - assertThat(ImmutableSet.copyOf(prestoReadColumns)).isEqualTo(expectedPrestoResults.keySet()); + assertThat(ImmutableSet.copyOf(trinoReadColumns)).isEqualTo(expectedTrinoResults.keySet()); } - String prestoSelectQuery = format("SELECT %s FROM %s", String.join(", ", prestoReadColumns), tableName); - assertQueryResults(Engine.TRINO, prestoSelectQuery, expectedPrestoResults, prestoReadColumns, 2); + String trinoSelectQuery = format("SELECT %s FROM %s", String.join(", ", trinoReadColumns), tableName); + assertQueryResults(Engine.TRINO, trinoSelectQuery, expectedTrinoResults, trinoReadColumns, 2); // Additional assertions for VARBINARY coercion - if (prestoReadColumns.contains("binary_to_string")) { + if (trinoReadColumns.contains("binary_to_string")) { List hexRepresentedValue = ImmutableList.of("58EFBFBDEFBFBDEFBFBDEFBFBD", "58EFBFBDEFBFBDEFBFBDEFBFBD58"); if (tableName.toLowerCase(ENGLISH).contains("orc")) { diff --git a/testing/trino-product-tests/src/main/java/io/trino/tests/product/hive/TestAvroSchemaUrl.java b/testing/trino-product-tests/src/main/java/io/trino/tests/product/hive/TestAvroSchemaUrl.java index 94368abc6094..e5aafaccc4be 100644 --- a/testing/trino-product-tests/src/main/java/io/trino/tests/product/hive/TestAvroSchemaUrl.java +++ b/testing/trino-product-tests/src/main/java/io/trino/tests/product/hive/TestAvroSchemaUrl.java @@ -76,7 +76,7 @@ private void saveResourceOnHdfs(String resource, String location) public Object[][] avroSchemaLocations() { return new Object[][] { - {"file:///docker/trino-product-tests/avro/original_schema.avsc"}, // mounted in hadoop and presto containers + {"file:///docker/trino-product-tests/avro/original_schema.avsc"}, // mounted in hadoop and trino containers {"hdfs://hadoop-master:9000/user/hive/warehouse/TestAvroSchemaUrl/schemas/original_schema.avsc"}, {"hdfs:///user/hive/warehouse/TestAvroSchemaUrl/schemas/original_schema.avsc"}, {"/user/hive/warehouse/TestAvroSchemaUrl/schemas/original_schema.avsc"}, // `avro.schema.url` can actually be path on HDFS (not URL) @@ -149,16 +149,16 @@ public void testAvroSchemaUrlInSerdeProperties() @Test(dataProvider = "avroSchemaLocations", groups = STORAGE_FORMATS) @Flaky(issue = RETRYABLE_FAILURES_ISSUES, match = RETRYABLE_FAILURES_MATCH) - public void testPrestoCreatedTable(String schemaLocation) + public void testTrinoCreatedTable(String schemaLocation) { - onTrino().executeQuery("DROP TABLE IF EXISTS test_avro_schema_url_presto"); - onTrino().executeQuery(format("CREATE TABLE test_avro_schema_url_presto (dummy_col VARCHAR) WITH (format='AVRO', avro_schema_url='%s')", schemaLocation)); - onTrino().executeQuery("INSERT INTO test_avro_schema_url_presto VALUES ('some text', 123042)"); + onTrino().executeQuery("DROP TABLE IF EXISTS test_avro_schema_url_trino"); + onTrino().executeQuery(format("CREATE TABLE test_avro_schema_url_trino (dummy_col VARCHAR) WITH (format='AVRO', avro_schema_url='%s')", schemaLocation)); + onTrino().executeQuery("INSERT INTO test_avro_schema_url_trino VALUES ('some text', 123042)"); - assertThat(onHive().executeQuery("SELECT * FROM test_avro_schema_url_presto")).containsExactlyInOrder(row("some text", 123042)); - assertThat(onTrino().executeQuery("SELECT * FROM test_avro_schema_url_presto")).containsExactlyInOrder(row("some text", 123042)); + assertThat(onHive().executeQuery("SELECT * FROM test_avro_schema_url_trino")).containsExactlyInOrder(row("some text", 123042)); + assertThat(onTrino().executeQuery("SELECT * FROM test_avro_schema_url_trino")).containsExactlyInOrder(row("some text", 123042)); - onTrino().executeQuery("DROP TABLE test_avro_schema_url_presto"); + onTrino().executeQuery("DROP TABLE test_avro_schema_url_trino"); } @Test(groups = STORAGE_FORMATS) diff --git a/testing/trino-product-tests/src/main/java/io/trino/tests/product/hive/TestGrantRevoke.java b/testing/trino-product-tests/src/main/java/io/trino/tests/product/hive/TestGrantRevoke.java index 10d875656afb..098f74a7d2ac 100644 --- a/testing/trino-product-tests/src/main/java/io/trino/tests/product/hive/TestGrantRevoke.java +++ b/testing/trino-product-tests/src/main/java/io/trino/tests/product/hive/TestGrantRevoke.java @@ -58,7 +58,7 @@ public class TestGrantRevoke * Pre-requisites for the tests in this class: * * (1) hive.properties file should have this property set: hive.security=sql-standard - * (2) tempto-configuration.yaml file should have definitions for the following connections to Presto server: + * (2) tempto-configuration.yaml file should have definitions for the following connections to Trino server: * - "alice@trino" that has "jdbc_user: alice" * - "bob@trino" that has "jdbc_user: bob" * - "charlie@trino" that has "jdbc_user: charlie" diff --git a/testing/trino-product-tests/src/main/java/io/trino/tests/product/hive/TestHiveBasicTableStatistics.java b/testing/trino-product-tests/src/main/java/io/trino/tests/product/hive/TestHiveBasicTableStatistics.java index 9cad3fe41ec4..f8adc77c7480 100644 --- a/testing/trino-product-tests/src/main/java/io/trino/tests/product/hive/TestHiveBasicTableStatistics.java +++ b/testing/trino-product-tests/src/main/java/io/trino/tests/product/hive/TestHiveBasicTableStatistics.java @@ -43,7 +43,7 @@ public class TestHiveBasicTableStatistics @Test public void testCreateUnpartitioned() { - String tableName = "test_basic_statistics_unpartitioned_ctas_presto"; + String tableName = "test_basic_statistics_unpartitioned_ctas_trino"; onTrino().executeQuery(format("DROP TABLE IF EXISTS %s", tableName)); onTrino().executeQuery(format("CREATE TABLE %s AS SELECT * FROM nation", tableName)); @@ -61,7 +61,7 @@ public void testCreateUnpartitioned() @Test public void testCreateExternalUnpartitioned() { - String tableName = "test_basic_statistics_external_unpartitioned_presto"; + String tableName = "test_basic_statistics_external_unpartitioned_trino"; onTrino().executeQuery(format("DROP TABLE IF EXISTS %s", tableName)); @@ -87,7 +87,7 @@ public void testCreateExternalUnpartitioned() @Test public void testCreateTableWithNoData() { - String tableName = "test_basic_statistics_unpartitioned_ctas_presto_with_no_data"; + String tableName = "test_basic_statistics_unpartitioned_ctas_trino_with_no_data"; onTrino().executeQuery(format("DROP TABLE IF EXISTS %s", tableName)); onTrino().executeQuery(format("CREATE TABLE %s AS SELECT * FROM nation WITH NO DATA", tableName)); @@ -104,7 +104,7 @@ public void testCreateTableWithNoData() @Test public void testInsertUnpartitioned() { - String tableName = "test_basic_statistics_unpartitioned_insert_presto"; + String tableName = "test_basic_statistics_unpartitioned_insert_trino"; onTrino().executeQuery(format("DROP TABLE IF EXISTS %s", tableName)); onTrino().executeQuery(format("" + @@ -140,7 +140,7 @@ public void testInsertUnpartitioned() @Test public void testCreatePartitioned() { - String tableName = "test_basic_statistics_partitioned_ctas_presto"; + String tableName = "test_basic_statistics_partitioned_ctas_trino"; onTrino().executeQuery(format("DROP TABLE IF EXISTS %s", tableName)); onTrino().executeQuery(format("" + @@ -252,7 +252,7 @@ public void testAnalyzeUnpartitioned() @Test public void testInsertPartitioned() { - String tableName = "test_basic_statistics_partitioned_insert_presto"; + String tableName = "test_basic_statistics_partitioned_insert_trino"; onTrino().executeQuery(format("DROP TABLE IF EXISTS %s", tableName)); onTrino().executeQuery(format("" + @@ -294,7 +294,7 @@ public void testInsertPartitioned() @Flaky(issue = RETRYABLE_FAILURES_ISSUES, match = RETRYABLE_FAILURES_MATCH) public void testInsertBucketed() { - String tableName = "test_basic_statistics_bucketed_insert_presto"; + String tableName = "test_basic_statistics_bucketed_insert_trino"; onTrino().executeQuery(format("DROP TABLE IF EXISTS %s", tableName)); onTrino().executeQuery(format("" + @@ -333,7 +333,7 @@ public void testInsertBucketed() @Test public void testInsertBucketedPartitioned() { - String tableName = "test_basic_statistics_bucketed_partitioned_insert_presto"; + String tableName = "test_basic_statistics_bucketed_partitioned_insert_trino"; onTrino().executeQuery(format("DROP TABLE IF EXISTS %s", tableName)); onTrino().executeQuery(format("" + diff --git a/testing/trino-product-tests/src/main/java/io/trino/tests/product/hive/TestHiveTableStatistics.java b/testing/trino-product-tests/src/main/java/io/trino/tests/product/hive/TestHiveTableStatistics.java index bdf1c9a202ce..aff4c7072059 100644 --- a/testing/trino-product-tests/src/main/java/io/trino/tests/product/hive/TestHiveTableStatistics.java +++ b/testing/trino-product-tests/src/main/java/io/trino/tests/product/hive/TestHiveTableStatistics.java @@ -1403,9 +1403,9 @@ public void testComputeStatisticsForTableWithOnlyDateColumns() @Test @Flaky(issue = RETRYABLE_FAILURES_ISSUES, match = RETRYABLE_FAILURES_MATCH) - public void testMixedHiveAndPrestoStatistics() + public void testMixedHiveAndTrinoStatistics() { - String tableName = "test_mixed_hive_and_presto_statistics"; + String tableName = "test_mixed_hive_and_trino_statistics"; onHive().executeQuery(format("DROP TABLE IF EXISTS %s", tableName)); onHive().executeQuery(format("CREATE TABLE %s (a INT) PARTITIONED BY (p INT) STORED AS ORC TBLPROPERTIES ('transactional' = 'false')", tableName)); diff --git a/testing/trino-product-tests/src/main/java/io/trino/tests/product/hive/TestHiveViewsLegacy.java b/testing/trino-product-tests/src/main/java/io/trino/tests/product/hive/TestHiveViewsLegacy.java index 5cff6090ac5c..d49318f8f349 100644 --- a/testing/trino-product-tests/src/main/java/io/trino/tests/product/hive/TestHiveViewsLegacy.java +++ b/testing/trino-product-tests/src/main/java/io/trino/tests/product/hive/TestHiveViewsLegacy.java @@ -114,7 +114,7 @@ public void testArrayIndexingInView() "[hive]\n" + "\n" + "actual rows:\n" + - "[presto]"); + "[trino]"); } @Override diff --git a/testing/trino-product-tests/src/main/java/io/trino/tests/product/hive/TestRoles.java b/testing/trino-product-tests/src/main/java/io/trino/tests/product/hive/TestRoles.java index 3b517e44c0c8..d214c71c6906 100644 --- a/testing/trino-product-tests/src/main/java/io/trino/tests/product/hive/TestRoles.java +++ b/testing/trino-product-tests/src/main/java/io/trino/tests/product/hive/TestRoles.java @@ -128,20 +128,20 @@ public void testCreateDropRoleAccessControl() { // Only users that are granted with "admin" role can create, drop and list roles // Alice is not granted with "admin" role - assertQueryFailure(() -> onPrestoAlice().executeQuery(format("CREATE ROLE %s IN hive", ROLE3))) + assertQueryFailure(() -> onTrinoAlice().executeQuery(format("CREATE ROLE %s IN hive", ROLE3))) .hasMessageContaining("Cannot create role %s", ROLE3); - assertQueryFailure(() -> onPrestoAlice().executeQuery(format("DROP ROLE %s IN hive", ROLE3))) + assertQueryFailure(() -> onTrinoAlice().executeQuery(format("DROP ROLE %s IN hive", ROLE3))) .hasMessageContaining("Cannot drop role %s", ROLE3); - assertQueryFailure(() -> onPrestoAlice().executeQuery("SELECT * FROM hive.information_schema.roles")) + assertQueryFailure(() -> onTrinoAlice().executeQuery("SELECT * FROM hive.information_schema.roles")) .hasMessageContaining("Cannot select from table information_schema.roles"); } @Test(groups = {AUTHORIZATION, PROFILE_SPECIFIC_TESTS}) public void testPublicRoleIsGrantedToEveryone() { - assertThat(onPrestoAlice().executeQuery("SELECT * FROM hive.information_schema.applicable_roles")) + assertThat(onTrinoAlice().executeQuery("SELECT * FROM hive.information_schema.applicable_roles")) .contains(row("alice", "USER", "public", "NO")); - assertThat(onPrestoBob().executeQuery("SELECT * FROM hive.information_schema.applicable_roles")) + assertThat(onTrinoBob().executeQuery("SELECT * FROM hive.information_schema.applicable_roles")) .contains(row("bob", "USER", "public", "NO")); } @@ -157,7 +157,7 @@ public void testGrantRoleToUser() { onTrino().executeQuery("CREATE ROLE role1 IN hive"); onTrino().executeQuery("GRANT role1 TO USER alice IN hive"); - assertThat(onPrestoAlice().executeQuery("SELECT * FROM hive.information_schema.applicable_roles")) + assertThat(onTrinoAlice().executeQuery("SELECT * FROM hive.information_schema.applicable_roles")) .containsOnly( row("alice", "USER", "public", "NO"), row("alice", "USER", "role1", "NO")); @@ -170,7 +170,7 @@ public void testGrantRoleToRole() onTrino().executeQuery("CREATE ROLE role2 IN hive"); onTrino().executeQuery("GRANT role1 TO USER alice IN hive"); onTrino().executeQuery("GRANT role2 TO ROLE role1 IN hive"); - assertThat(onPrestoAlice().executeQuery("SELECT * FROM hive.information_schema.applicable_roles")) + assertThat(onTrinoAlice().executeQuery("SELECT * FROM hive.information_schema.applicable_roles")) .containsOnly( row("alice", "USER", "public", "NO"), row("alice", "USER", "role1", "NO"), @@ -184,7 +184,7 @@ public void testGrantRoleWithAdminOption() onTrino().executeQuery("CREATE ROLE role2 IN hive"); onTrino().executeQuery("GRANT role1 TO USER alice WITH ADMIN OPTION IN hive"); onTrino().executeQuery("GRANT role2 TO ROLE role1 WITH ADMIN OPTION IN hive"); - assertThat(onPrestoAlice().executeQuery("SELECT * FROM hive.information_schema.applicable_roles")) + assertThat(onTrinoAlice().executeQuery("SELECT * FROM hive.information_schema.applicable_roles")) .containsOnly( row("alice", "USER", "public", "NO"), row("alice", "USER", "role1", "YES"), @@ -204,7 +204,7 @@ public void testGrantRoleMultipleTimes() onTrino().executeQuery("GRANT role2 TO ROLE role1 WITH ADMIN OPTION IN hive"); onTrino().executeQuery("GRANT role1 TO USER alice WITH ADMIN OPTION IN hive"); onTrino().executeQuery("GRANT role2 TO ROLE role1 WITH ADMIN OPTION IN hive"); - assertThat(onPrestoAlice().executeQuery("SELECT * FROM hive.information_schema.applicable_roles")) + assertThat(onTrinoAlice().executeQuery("SELECT * FROM hive.information_schema.applicable_roles")) .containsOnly( row("alice", "USER", "public", "NO"), row("alice", "USER", "role1", "YES"), @@ -216,13 +216,13 @@ public void testRevokeRoleFromUser() { onTrino().executeQuery("CREATE ROLE role1 IN hive"); onTrino().executeQuery("GRANT role1 TO USER alice IN hive"); - assertThat(onPrestoAlice().executeQuery("SELECT * FROM hive.information_schema.applicable_roles")) + assertThat(onTrinoAlice().executeQuery("SELECT * FROM hive.information_schema.applicable_roles")) .containsOnly( row("alice", "USER", "public", "NO"), row("alice", "USER", "role1", "NO")); onTrino().executeQuery("REVOKE role1 FROM USER alice IN hive"); - assertThat(onPrestoAlice().executeQuery("SELECT * FROM hive.information_schema.applicable_roles")) + assertThat(onTrinoAlice().executeQuery("SELECT * FROM hive.information_schema.applicable_roles")) .containsOnly( row("alice", "USER", "public", "NO")); } @@ -234,14 +234,14 @@ public void testRevokeRoleFromRole() onTrino().executeQuery("CREATE ROLE role2 IN hive"); onTrino().executeQuery("GRANT role1 TO USER alice IN hive"); onTrino().executeQuery("GRANT role2 TO ROLE role1 IN hive"); - assertThat(onPrestoAlice().executeQuery("SELECT * FROM hive.information_schema.applicable_roles")) + assertThat(onTrinoAlice().executeQuery("SELECT * FROM hive.information_schema.applicable_roles")) .containsOnly( row("alice", "USER", "public", "NO"), row("alice", "USER", "role1", "NO"), row("role1", "ROLE", "role2", "NO")); onTrino().executeQuery("REVOKE role2 FROM ROLE role1 IN hive"); - assertThat(onPrestoAlice().executeQuery("SELECT * FROM hive.information_schema.applicable_roles")) + assertThat(onTrinoAlice().executeQuery("SELECT * FROM hive.information_schema.applicable_roles")) .containsOnly( row("alice", "USER", "public", "NO"), row("alice", "USER", "role1", "NO")); @@ -251,8 +251,8 @@ public void testRevokeRoleFromRole() public void testRevokeRoleFromOwner() { try { - onPrestoAlice().executeQuery("CREATE TABLE hive.default.test_table (foo BIGINT)"); - assertThat(onPrestoAlice().executeQuery("SHOW GRANTS ON hive.default.test_table")) + onTrinoAlice().executeQuery("CREATE TABLE hive.default.test_table (foo BIGINT)"); + assertThat(onTrinoAlice().executeQuery("SHOW GRANTS ON hive.default.test_table")) .containsOnly(ImmutableList.of( row("alice", "USER", "alice", "USER", "hive", "default", "test_table", "SELECT", "YES", null), row("alice", "USER", "alice", "USER", "hive", "default", "test_table", "DELETE", "YES", null), @@ -262,14 +262,14 @@ public void testRevokeRoleFromOwner() onTrino().executeQuery("REVOKE SELECT ON hive.default.test_table FROM USER alice"); // now there should be no SELECT privileges shown even though alice has OWNERSHIP - assertThat(onPrestoAlice().executeQuery("SHOW GRANTS ON hive.default.test_table")) + assertThat(onTrinoAlice().executeQuery("SHOW GRANTS ON hive.default.test_table")) .containsOnly(ImmutableList.of( row("alice", "USER", "alice", "USER", "hive", "default", "test_table", "DELETE", "YES", null), row("alice", "USER", "alice", "USER", "hive", "default", "test_table", "UPDATE", "YES", null), row("alice", "USER", "alice", "USER", "hive", "default", "test_table", "INSERT", "YES", null))); } finally { - onPrestoAlice().executeQuery("DROP TABLE IF EXISTS hive.default.test_table"); + onTrinoAlice().executeQuery("DROP TABLE IF EXISTS hive.default.test_table"); } } @@ -278,13 +278,13 @@ public void testDropGrantedRole() { onTrino().executeQuery("CREATE ROLE role1 IN hive"); onTrino().executeQuery("GRANT role1 TO USER alice IN hive"); - assertThat(onPrestoAlice().executeQuery("SELECT * FROM hive.information_schema.applicable_roles")) + assertThat(onTrinoAlice().executeQuery("SELECT * FROM hive.information_schema.applicable_roles")) .containsOnly( row("alice", "USER", "public", "NO"), row("alice", "USER", "role1", "NO")); onTrino().executeQuery("DROP ROLE role1 IN hive"); - assertThat(onPrestoAlice().executeQuery("SELECT * FROM hive.information_schema.applicable_roles")) + assertThat(onTrinoAlice().executeQuery("SELECT * FROM hive.information_schema.applicable_roles")) .containsOnly( row("alice", "USER", "public", "NO")); } @@ -296,14 +296,14 @@ public void testRevokeTransitiveRoleFromUser() onTrino().executeQuery("CREATE ROLE role2 IN hive"); onTrino().executeQuery("GRANT role1 TO USER alice IN hive"); onTrino().executeQuery("GRANT role2 TO ROLE role1 IN hive"); - assertThat(onPrestoAlice().executeQuery("SELECT * FROM hive.information_schema.applicable_roles")) + assertThat(onTrinoAlice().executeQuery("SELECT * FROM hive.information_schema.applicable_roles")) .containsOnly( row("alice", "USER", "public", "NO"), row("alice", "USER", "role1", "NO"), row("role1", "ROLE", "role2", "NO")); onTrino().executeQuery("REVOKE role1 FROM USER alice IN hive"); - assertThat(onPrestoAlice().executeQuery("SELECT * FROM hive.information_schema.applicable_roles")) + assertThat(onTrinoAlice().executeQuery("SELECT * FROM hive.information_schema.applicable_roles")) .containsOnly( row("alice", "USER", "public", "NO")); } @@ -317,7 +317,7 @@ public void testRevokeTransitiveRoleFromRole() onTrino().executeQuery("GRANT role1 TO USER alice IN hive"); onTrino().executeQuery("GRANT role2 TO ROLE role1 IN hive"); onTrino().executeQuery("GRANT role3 TO ROLE role2 IN hive"); - assertThat(onPrestoAlice().executeQuery("SELECT * FROM hive.information_schema.applicable_roles")) + assertThat(onTrinoAlice().executeQuery("SELECT * FROM hive.information_schema.applicable_roles")) .containsOnly( row("alice", "USER", "public", "NO"), row("alice", "USER", "role1", "NO"), @@ -325,7 +325,7 @@ public void testRevokeTransitiveRoleFromRole() row("role2", "ROLE", "role3", "NO")); onTrino().executeQuery("REVOKE role2 FROM ROLE role1 IN hive"); - assertThat(onPrestoAlice().executeQuery("SELECT * FROM hive.information_schema.applicable_roles")) + assertThat(onTrinoAlice().executeQuery("SELECT * FROM hive.information_schema.applicable_roles")) .containsOnly( row("alice", "USER", "public", "NO"), row("alice", "USER", "role1", "NO")); @@ -340,7 +340,7 @@ public void testDropTransitiveRole() onTrino().executeQuery("GRANT role1 TO USER alice IN hive"); onTrino().executeQuery("GRANT role2 TO ROLE role1 IN hive"); onTrino().executeQuery("GRANT role3 TO ROLE role2 IN hive"); - assertThat(onPrestoAlice().executeQuery("SELECT * FROM hive.information_schema.applicable_roles")) + assertThat(onTrinoAlice().executeQuery("SELECT * FROM hive.information_schema.applicable_roles")) .containsOnly( row("alice", "USER", "public", "NO"), row("alice", "USER", "role1", "NO"), @@ -348,7 +348,7 @@ public void testDropTransitiveRole() row("role2", "ROLE", "role3", "NO")); onTrino().executeQuery("DROP ROLE role2 IN hive"); - assertThat(onPrestoAlice().executeQuery("SELECT * FROM hive.information_schema.applicable_roles")) + assertThat(onTrinoAlice().executeQuery("SELECT * FROM hive.information_schema.applicable_roles")) .containsOnly( row("alice", "USER", "public", "NO"), row("alice", "USER", "role1", "NO")); @@ -361,7 +361,7 @@ public void testRevokeAdminOption() onTrino().executeQuery("CREATE ROLE role2 IN hive"); onTrino().executeQuery("GRANT role1 TO USER alice WITH ADMIN OPTION IN hive"); onTrino().executeQuery("GRANT role2 TO ROLE role1 WITH ADMIN OPTION IN hive"); - assertThat(onPrestoAlice().executeQuery("SELECT * FROM hive.information_schema.applicable_roles")) + assertThat(onTrinoAlice().executeQuery("SELECT * FROM hive.information_schema.applicable_roles")) .containsOnly( row("alice", "USER", "public", "NO"), row("alice", "USER", "role1", "YES"), @@ -370,7 +370,7 @@ public void testRevokeAdminOption() onTrino().executeQuery("REVOKE ADMIN OPTION FOR role1 FROM USER alice IN hive"); onTrino().executeQuery("REVOKE ADMIN OPTION FOR role2 FROM ROLE role1 IN hive"); - assertThat(onPrestoAlice().executeQuery("SELECT * FROM hive.information_schema.applicable_roles")) + assertThat(onTrinoAlice().executeQuery("SELECT * FROM hive.information_schema.applicable_roles")) .containsOnly( row("alice", "USER", "public", "NO"), row("alice", "USER", "role1", "NO"), @@ -384,7 +384,7 @@ public void testRevokeMultipleTimes() onTrino().executeQuery("CREATE ROLE role2 IN hive"); onTrino().executeQuery("GRANT role1 TO USER alice WITH ADMIN OPTION IN hive"); onTrino().executeQuery("GRANT role2 TO ROLE role1 WITH ADMIN OPTION IN hive"); - assertThat(onPrestoAlice().executeQuery("SELECT * FROM hive.information_schema.applicable_roles")) + assertThat(onTrinoAlice().executeQuery("SELECT * FROM hive.information_schema.applicable_roles")) .containsOnly( row("alice", "USER", "public", "NO"), row("alice", "USER", "role1", "YES"), @@ -395,7 +395,7 @@ public void testRevokeMultipleTimes() onTrino().executeQuery("REVOKE ADMIN OPTION FOR role2 FROM ROLE role1 IN hive"); onTrino().executeQuery("REVOKE ADMIN OPTION FOR role2 FROM ROLE role1 IN hive"); - assertThat(onPrestoAlice().executeQuery("SELECT * FROM hive.information_schema.applicable_roles")) + assertThat(onTrinoAlice().executeQuery("SELECT * FROM hive.information_schema.applicable_roles")) .containsOnly( row("alice", "USER", "public", "NO"), row("alice", "USER", "role1", "NO"), @@ -406,7 +406,7 @@ public void testRevokeMultipleTimes() onTrino().executeQuery("REVOKE role2 FROM ROLE role1 IN hive"); onTrino().executeQuery("REVOKE role2 FROM ROLE role1 IN hive"); - assertThat(onPrestoAlice().executeQuery("SELECT * FROM hive.information_schema.applicable_roles")) + assertThat(onTrinoAlice().executeQuery("SELECT * FROM hive.information_schema.applicable_roles")) .containsOnly( row("alice", "USER", "public", "NO")); } @@ -417,50 +417,50 @@ public void testGrantRevokeRoleAccessControl() onTrino().executeQuery("CREATE ROLE role1 IN hive"); onTrino().executeQuery("CREATE ROLE role2 IN hive"); - assertQueryFailure(() -> onPrestoAlice().executeQuery("GRANT role1 TO USER bob IN hive")) + assertQueryFailure(() -> onTrinoAlice().executeQuery("GRANT role1 TO USER bob IN hive")) .hasMessageContaining("Cannot grant roles [role1] to [USER bob]"); - assertQueryFailure(() -> onPrestoAlice().executeQuery("GRANT role1 TO USER bob WITH ADMIN OPTION IN hive")) + assertQueryFailure(() -> onTrinoAlice().executeQuery("GRANT role1 TO USER bob WITH ADMIN OPTION IN hive")) .hasMessageContaining("Cannot grant roles [role1] to [USER bob]"); - assertQueryFailure(() -> onPrestoAlice().executeQuery("REVOKE role1 FROM USER bob IN hive")) + assertQueryFailure(() -> onTrinoAlice().executeQuery("REVOKE role1 FROM USER bob IN hive")) .hasMessageContaining("Cannot revoke roles [role1] from [USER bob]"); - assertQueryFailure(() -> onPrestoAlice().executeQuery("REVOKE ADMIN OPTION FOR role1 FROM USER bob IN hive")) + assertQueryFailure(() -> onTrinoAlice().executeQuery("REVOKE ADMIN OPTION FOR role1 FROM USER bob IN hive")) .hasMessageContaining("Cannot revoke roles [role1] from [USER bob]"); onTrino().executeQuery("GRANT role1 TO USER alice WITH ADMIN OPTION IN hive"); - onPrestoAlice().executeQuery("GRANT role1 TO USER bob IN hive"); - onPrestoAlice().executeQuery("GRANT role1 TO USER bob WITH ADMIN OPTION IN hive"); - onPrestoAlice().executeQuery("REVOKE ADMIN OPTION FOR role1 FROM USER bob IN hive"); - onPrestoAlice().executeQuery("REVOKE role1 FROM USER bob IN hive"); + onTrinoAlice().executeQuery("GRANT role1 TO USER bob IN hive"); + onTrinoAlice().executeQuery("GRANT role1 TO USER bob WITH ADMIN OPTION IN hive"); + onTrinoAlice().executeQuery("REVOKE ADMIN OPTION FOR role1 FROM USER bob IN hive"); + onTrinoAlice().executeQuery("REVOKE role1 FROM USER bob IN hive"); onTrino().executeQuery("REVOKE ADMIN OPTION FOR role1 FROM USER alice IN hive"); - assertQueryFailure(() -> onPrestoAlice().executeQuery("GRANT role1 TO USER bob IN hive")) + assertQueryFailure(() -> onTrinoAlice().executeQuery("GRANT role1 TO USER bob IN hive")) .hasMessageContaining("Cannot grant roles [role1] to [USER bob]"); - assertQueryFailure(() -> onPrestoAlice().executeQuery("GRANT role1 TO USER bob WITH ADMIN OPTION IN hive")) + assertQueryFailure(() -> onTrinoAlice().executeQuery("GRANT role1 TO USER bob WITH ADMIN OPTION IN hive")) .hasMessageContaining("Cannot grant roles [role1] to [USER bob]"); - assertQueryFailure(() -> onPrestoAlice().executeQuery("REVOKE role1 FROM USER bob IN hive")) + assertQueryFailure(() -> onTrinoAlice().executeQuery("REVOKE role1 FROM USER bob IN hive")) .hasMessageContaining("Cannot revoke roles [role1] from [USER bob]"); - assertQueryFailure(() -> onPrestoAlice().executeQuery("REVOKE ADMIN OPTION FOR role1 FROM USER bob IN hive")) + assertQueryFailure(() -> onTrinoAlice().executeQuery("REVOKE ADMIN OPTION FOR role1 FROM USER bob IN hive")) .hasMessageContaining("Cannot revoke roles [role1] from [USER bob]"); onTrino().executeQuery("GRANT role2 TO USER alice IN hive"); onTrino().executeQuery("GRANT role1 TO ROLE role2 WITH ADMIN OPTION IN hive"); - onPrestoAlice().executeQuery("GRANT role1 TO USER bob IN hive"); - onPrestoAlice().executeQuery("GRANT role1 TO USER bob WITH ADMIN OPTION IN hive"); - onPrestoAlice().executeQuery("REVOKE ADMIN OPTION FOR role1 FROM USER bob IN hive"); - onPrestoAlice().executeQuery("REVOKE role1 FROM USER bob IN hive"); + onTrinoAlice().executeQuery("GRANT role1 TO USER bob IN hive"); + onTrinoAlice().executeQuery("GRANT role1 TO USER bob WITH ADMIN OPTION IN hive"); + onTrinoAlice().executeQuery("REVOKE ADMIN OPTION FOR role1 FROM USER bob IN hive"); + onTrinoAlice().executeQuery("REVOKE role1 FROM USER bob IN hive"); - onPrestoAlice().executeQuery("REVOKE ADMIN OPTION FOR role1 FROM ROLE role2 IN hive"); + onTrinoAlice().executeQuery("REVOKE ADMIN OPTION FOR role1 FROM ROLE role2 IN hive"); - assertQueryFailure(() -> onPrestoAlice().executeQuery("GRANT role1 TO USER bob IN hive")) + assertQueryFailure(() -> onTrinoAlice().executeQuery("GRANT role1 TO USER bob IN hive")) .hasMessageContaining("Cannot grant roles [role1] to [USER bob]"); - assertQueryFailure(() -> onPrestoAlice().executeQuery("GRANT role1 TO USER bob WITH ADMIN OPTION IN hive")) + assertQueryFailure(() -> onTrinoAlice().executeQuery("GRANT role1 TO USER bob WITH ADMIN OPTION IN hive")) .hasMessageContaining("Cannot grant roles [role1] to [USER bob]"); - assertQueryFailure(() -> onPrestoAlice().executeQuery("REVOKE role1 FROM USER bob IN hive")) + assertQueryFailure(() -> onTrinoAlice().executeQuery("REVOKE role1 FROM USER bob IN hive")) .hasMessageContaining("Cannot revoke roles [role1] from [USER bob]"); - assertQueryFailure(() -> onPrestoAlice().executeQuery("REVOKE ADMIN OPTION FOR role1 FROM USER bob IN hive")) + assertQueryFailure(() -> onTrinoAlice().executeQuery("REVOKE ADMIN OPTION FOR role1 FROM USER bob IN hive")) .hasMessageContaining("Cannot revoke roles [role1] from [USER bob]"); } @@ -474,36 +474,36 @@ public void testSetRole() onTrino().executeQuery("GRANT role2 TO ROLE role1 IN hive"); onTrino().executeQuery("GRANT role3 TO ROLE role2 IN hive"); - onPrestoAlice().executeQuery("SET ROLE ALL IN hive"); - assertThat(onPrestoAlice().executeQuery("SELECT * FROM hive.information_schema.enabled_roles")) + onTrinoAlice().executeQuery("SET ROLE ALL IN hive"); + assertThat(onTrinoAlice().executeQuery("SELECT * FROM hive.information_schema.enabled_roles")) .containsOnly( row("public"), row("role1"), row("role2"), row("role3")); - onPrestoAlice().executeQuery("SET ROLE NONE IN hive"); - assertThat(onPrestoAlice().executeQuery("SELECT * FROM hive.information_schema.enabled_roles")) + onTrinoAlice().executeQuery("SET ROLE NONE IN hive"); + assertThat(onTrinoAlice().executeQuery("SELECT * FROM hive.information_schema.enabled_roles")) .containsOnly( row("public")); - onPrestoAlice().executeQuery("SET ROLE role1 IN hive"); - assertThat(onPrestoAlice().executeQuery("SELECT * FROM hive.information_schema.enabled_roles")) + onTrinoAlice().executeQuery("SET ROLE role1 IN hive"); + assertThat(onTrinoAlice().executeQuery("SELECT * FROM hive.information_schema.enabled_roles")) .containsOnly( row("public"), row("role1"), row("role2"), row("role3")); - onPrestoAlice().executeQuery("SET ROLE role2 IN hive"); - assertThat(onPrestoAlice().executeQuery("SELECT * FROM hive.information_schema.enabled_roles")) + onTrinoAlice().executeQuery("SET ROLE role2 IN hive"); + assertThat(onTrinoAlice().executeQuery("SELECT * FROM hive.information_schema.enabled_roles")) .containsOnly( row("public"), row("role2"), row("role3")); - onPrestoAlice().executeQuery("SET ROLE role3 IN hive"); - assertThat(onPrestoAlice().executeQuery("SELECT * FROM hive.information_schema.enabled_roles")) + onTrinoAlice().executeQuery("SET ROLE role3 IN hive"); + assertThat(onTrinoAlice().executeQuery("SELECT * FROM hive.information_schema.enabled_roles")) .containsOnly( row("public"), row("role3")); @@ -536,11 +536,11 @@ public void testShowRoles() row("public"), row("admin"), row("role1")); - assertQueryFailure(() -> onPrestoAlice().executeQuery("SHOW ROLES FROM hive")) + assertQueryFailure(() -> onTrinoAlice().executeQuery("SHOW ROLES FROM hive")) .hasMessageContaining("Cannot show roles"); onTrino().executeQuery("GRANT admin TO alice IN hive"); - onPrestoAlice().executeQuery("SET ROLE admin IN hive"); - assertThat(onPrestoAlice().executeQuery("SHOW ROLES FROM hive")) + onTrinoAlice().executeQuery("SET ROLE admin IN hive"); + assertThat(onTrinoAlice().executeQuery("SHOW ROLES FROM hive")) .containsOnly( row("public"), row("admin"), @@ -550,20 +550,20 @@ public void testShowRoles() @Test(groups = {AUTHORIZATION, PROFILE_SPECIFIC_TESTS}) public void testShowCurrentRoles() { - assertThat(onPrestoAlice().executeQuery("SHOW CURRENT ROLES FROM hive")) + assertThat(onTrinoAlice().executeQuery("SHOW CURRENT ROLES FROM hive")) .containsOnly( row("public")); onTrino().executeQuery("CREATE ROLE role1 IN hive"); onTrino().executeQuery("CREATE ROLE role2 IN hive"); onTrino().executeQuery("GRANT role1 TO alice IN hive"); onTrino().executeQuery("GRANT role2 TO alice IN hive"); - assertThat(onPrestoAlice().executeQuery("SHOW CURRENT ROLES FROM hive")) + assertThat(onTrinoAlice().executeQuery("SHOW CURRENT ROLES FROM hive")) .containsOnly( row("public"), row("role1"), row("role2")); - onPrestoAlice().executeQuery("SET ROLE role2 IN hive"); - assertThat(onPrestoAlice().executeQuery("SHOW CURRENT ROLES FROM hive")) + onTrinoAlice().executeQuery("SET ROLE role2 IN hive"); + assertThat(onTrinoAlice().executeQuery("SHOW CURRENT ROLES FROM hive")) .containsOnly( row("public"), row("role2")); @@ -576,7 +576,7 @@ public void testShowRoleGrants() .containsOnly( row("public"), row("admin")); - assertThat(onPrestoAlice().executeQuery("SHOW ROLE GRANTS FROM hive")) + assertThat(onTrinoAlice().executeQuery("SHOW ROLE GRANTS FROM hive")) .containsOnly( row("public")); onTrino().executeQuery("CREATE ROLE role1 IN hive"); @@ -587,7 +587,7 @@ public void testShowRoleGrants() .containsOnly( row("public"), row("admin")); - assertThat(onPrestoAlice().executeQuery("SHOW ROLE GRANTS FROM hive")) + assertThat(onTrinoAlice().executeQuery("SHOW ROLE GRANTS FROM hive")) .containsOnly( row("public"), row("role1")); @@ -603,61 +603,61 @@ public void testSetRoleCreateDropSchema() @Test(groups = {AUTHORIZATION, PROFILE_SPECIFIC_TESTS}) public void testAdminCanDropAnyTable() { - onPrestoAlice().executeQuery("CREATE TABLE hive.default.test_table (foo BIGINT)"); + onTrinoAlice().executeQuery("CREATE TABLE hive.default.test_table (foo BIGINT)"); assertAdminExecute("DROP TABLE hive.default.test_table"); } @Test(groups = {AUTHORIZATION, PROFILE_SPECIFIC_TESTS}) public void testAdminCanRenameAnyTable() { - onPrestoAlice().executeQuery("CREATE TABLE hive.default.test_table (foo BIGINT)"); + onTrinoAlice().executeQuery("CREATE TABLE hive.default.test_table (foo BIGINT)"); assertAdminExecute("ALTER TABLE hive.default.test_table RENAME TO hive.default.test_table_1"); - onPrestoAlice().executeQuery("DROP TABLE hive.default.test_table_1"); + onTrinoAlice().executeQuery("DROP TABLE hive.default.test_table_1"); } @Test(groups = {AUTHORIZATION, PROFILE_SPECIFIC_TESTS}) public void testAdminCanAddColumnToAnyTable() { - onPrestoAlice().executeQuery("CREATE TABLE hive.default.test_table (foo BIGINT)"); + onTrinoAlice().executeQuery("CREATE TABLE hive.default.test_table (foo BIGINT)"); assertAdminExecute("ALTER TABLE hive.default.test_table ADD COLUMN bar DATE"); - onPrestoAlice().executeQuery("DROP TABLE hive.default.test_table"); + onTrinoAlice().executeQuery("DROP TABLE hive.default.test_table"); } @Test(groups = {AUTHORIZATION, PROFILE_SPECIFIC_TESTS}) public void testAdminCanRenameColumnInAnyTable() { - onPrestoAlice().executeQuery("CREATE TABLE hive.default.test_table (foo BIGINT)"); + onTrinoAlice().executeQuery("CREATE TABLE hive.default.test_table (foo BIGINT)"); assertAdminExecute("ALTER TABLE hive.default.test_table RENAME COLUMN foo TO bar"); - onPrestoAlice().executeQuery("DROP TABLE hive.default.test_table"); + onTrinoAlice().executeQuery("DROP TABLE hive.default.test_table"); } @Test(groups = {AUTHORIZATION, PROFILE_SPECIFIC_TESTS}) public void testAdminCanShowAllGrants() { try { - onPrestoBob().executeQuery("CREATE TABLE hive.default.test_table_bob (foo BIGINT)"); - onPrestoAlice().executeQuery("CREATE TABLE hive.default.test_table_alice (foo BIGINT)"); + onTrinoBob().executeQuery("CREATE TABLE hive.default.test_table_bob (foo BIGINT)"); + onTrinoAlice().executeQuery("CREATE TABLE hive.default.test_table_alice (foo BIGINT)"); onTrino().executeQuery("GRANT admin TO alice IN hive"); - onPrestoAlice().executeQuery("SET ROLE ADMIN IN hive"); + onTrinoAlice().executeQuery("SET ROLE ADMIN IN hive"); - assertThat(onPrestoAlice().executeQuery("SHOW GRANTS ON hive.default.test_table_alice")) + assertThat(onTrinoAlice().executeQuery("SHOW GRANTS ON hive.default.test_table_alice")) .containsOnly(ImmutableList.of( row("alice", "USER", "alice", "USER", "hive", "default", "test_table_alice", "SELECT", "YES", null), row("alice", "USER", "alice", "USER", "hive", "default", "test_table_alice", "DELETE", "YES", null), row("alice", "USER", "alice", "USER", "hive", "default", "test_table_alice", "UPDATE", "YES", null), row("alice", "USER", "alice", "USER", "hive", "default", "test_table_alice", "INSERT", "YES", null))); - assertThat(onPrestoAlice().executeQuery("SHOW GRANTS ON hive.default.test_table_bob")) + assertThat(onTrinoAlice().executeQuery("SHOW GRANTS ON hive.default.test_table_bob")) .containsOnly(ImmutableList.of( row("bob", "USER", "bob", "USER", "hive", "default", "test_table_bob", "SELECT", "YES", null), row("bob", "USER", "bob", "USER", "hive", "default", "test_table_bob", "DELETE", "YES", null), row("bob", "USER", "bob", "USER", "hive", "default", "test_table_bob", "UPDATE", "YES", null), row("bob", "USER", "bob", "USER", "hive", "default", "test_table_bob", "INSERT", "YES", null))); - onPrestoAlice().executeQuery("GRANT SELECT ON hive.default.test_table_alice TO bob WITH GRANT OPTION"); - onPrestoAlice().executeQuery("GRANT INSERT ON hive.default.test_table_alice TO bob"); + onTrinoAlice().executeQuery("GRANT SELECT ON hive.default.test_table_alice TO bob WITH GRANT OPTION"); + onTrinoAlice().executeQuery("GRANT INSERT ON hive.default.test_table_alice TO bob"); - assertThat(onPrestoAlice().executeQuery("SHOW GRANTS ON hive.default.test_table_alice")) + assertThat(onTrinoAlice().executeQuery("SHOW GRANTS ON hive.default.test_table_alice")) .containsOnly(ImmutableList.of( row("alice", "USER", "alice", "USER", "hive", "default", "test_table_alice", "SELECT", "YES", null), row("alice", "USER", "alice", "USER", "hive", "default", "test_table_alice", "DELETE", "YES", null), @@ -667,8 +667,8 @@ public void testAdminCanShowAllGrants() row("alice", "USER", "bob", "USER", "hive", "default", "test_table_alice", "INSERT", "NO", null))); } finally { - onPrestoAlice().executeQuery("DROP TABLE IF EXISTS hive.default.test_table_alice"); - onPrestoBob().executeQuery("DROP TABLE IF EXISTS hive.default.test_table_bob"); + onTrinoAlice().executeQuery("DROP TABLE IF EXISTS hive.default.test_table_alice"); + onTrinoBob().executeQuery("DROP TABLE IF EXISTS hive.default.test_table_bob"); onTrino().executeQuery("REVOKE admin FROM alice IN hive"); } } @@ -677,26 +677,26 @@ public void testAdminCanShowAllGrants() public void testAdminCanShowGrantsOnlyFromCurrentSchema() { try { - onPrestoBob().executeQuery("CREATE TABLE hive.default.test_table_bob (foo BIGINT)"); + onTrinoBob().executeQuery("CREATE TABLE hive.default.test_table_bob (foo BIGINT)"); onTrino().executeQuery("CREATE SCHEMA hive.test"); onTrino().executeQuery("GRANT admin TO alice IN hive"); - onPrestoAlice().executeQuery("SET ROLE ADMIN IN hive"); - onPrestoAlice().executeQuery("CREATE TABLE hive.test.test_table_bob (foo BIGINT) with (external_location='/tmp')"); + onTrinoAlice().executeQuery("SET ROLE ADMIN IN hive"); + onTrinoAlice().executeQuery("CREATE TABLE hive.test.test_table_bob (foo BIGINT) with (external_location='/tmp')"); - assertThat(onPrestoAlice().executeQuery("SHOW GRANTS ON hive.default.test_table_bob")) + assertThat(onTrinoAlice().executeQuery("SHOW GRANTS ON hive.default.test_table_bob")) .containsOnly(ImmutableList.of( row("bob", "USER", "bob", "USER", "hive", "default", "test_table_bob", "SELECT", "YES", null), row("bob", "USER", "bob", "USER", "hive", "default", "test_table_bob", "DELETE", "YES", null), row("bob", "USER", "bob", "USER", "hive", "default", "test_table_bob", "UPDATE", "YES", null), row("bob", "USER", "bob", "USER", "hive", "default", "test_table_bob", "INSERT", "YES", null))); - assertThat(onPrestoAlice().executeQuery("SHOW GRANTS ON hive.test.test_table_bob")) + assertThat(onTrinoAlice().executeQuery("SHOW GRANTS ON hive.test.test_table_bob")) .containsOnly(ImmutableList.of( row("alice", "USER", "alice", "USER", "hive", "test", "test_table_bob", "SELECT", "YES", null), row("alice", "USER", "alice", "USER", "hive", "test", "test_table_bob", "DELETE", "YES", null), row("alice", "USER", "alice", "USER", "hive", "test", "test_table_bob", "UPDATE", "YES", null), row("alice", "USER", "alice", "USER", "hive", "test", "test_table_bob", "INSERT", "YES", null))); - assertThat(onPrestoAlice().executeQuery("SELECT * FROM hive.information_schema.table_privileges where table_name = 'test_table_bob'")) + assertThat(onTrinoAlice().executeQuery("SELECT * FROM hive.information_schema.table_privileges where table_name = 'test_table_bob'")) .containsOnly(ImmutableList.of( row("bob", "USER", "bob", "USER", "hive", "default", "test_table_bob", "SELECT", "YES", null), row("bob", "USER", "bob", "USER", "hive", "default", "test_table_bob", "DELETE", "YES", null), @@ -708,8 +708,8 @@ public void testAdminCanShowGrantsOnlyFromCurrentSchema() row("alice", "USER", "alice", "USER", "hive", "test", "test_table_bob", "INSERT", "YES", null))); } finally { - onPrestoBob().executeQuery("DROP TABLE IF EXISTS hive.default.test_table_bob"); - onPrestoAlice().executeQuery("DROP TABLE IF EXISTS hive.test.test_table_bob"); + onTrinoBob().executeQuery("DROP TABLE IF EXISTS hive.default.test_table_bob"); + onTrinoAlice().executeQuery("DROP TABLE IF EXISTS hive.test.test_table_bob"); onTrino().executeQuery("DROP SCHEMA IF EXISTS hive.test"); onTrino().executeQuery("REVOKE admin FROM alice IN hive"); } @@ -724,9 +724,9 @@ public void testSetRoleTablePermissions() onTrino().executeQuery("GRANT role1 TO USER bob IN hive"); onTrino().executeQuery("GRANT role2 TO USER bob IN hive"); - onPrestoAlice().executeQuery("CREATE TABLE hive.default.test_table (foo BIGINT)"); - onPrestoAlice().executeQuery("GRANT SELECT ON hive.default.test_table TO ROLE role1"); - onPrestoAlice().executeQuery("GRANT INSERT ON hive.default.test_table TO ROLE role2"); + onTrinoAlice().executeQuery("CREATE TABLE hive.default.test_table (foo BIGINT)"); + onTrinoAlice().executeQuery("GRANT SELECT ON hive.default.test_table TO ROLE role1"); + onTrinoAlice().executeQuery("GRANT INSERT ON hive.default.test_table TO ROLE role2"); String select = "SELECT * FROM hive.default.test_table"; String insert = "INSERT INTO hive.default.test_table (foo) VALUES (1)"; @@ -734,46 +734,46 @@ public void testSetRoleTablePermissions() assertAdminExecute(select); assertAdminExecute(insert); - onPrestoBob().executeQuery(select); - onPrestoBob().executeQuery(insert); - assertThat(onPrestoBob().executeQuery("SHOW GRANTS ON hive.default.test_table")) + onTrinoBob().executeQuery(select); + onTrinoBob().executeQuery(insert); + assertThat(onTrinoBob().executeQuery("SHOW GRANTS ON hive.default.test_table")) .containsOnly(ImmutableList.of( row("alice", "USER", "role1", "ROLE", "hive", "default", "test_table", "SELECT", "NO", null), row("alice", "USER", "role2", "ROLE", "hive", "default", "test_table", "INSERT", "NO", null))); - onPrestoBob().executeQuery("SET ROLE ALL IN hive"); - onPrestoBob().executeQuery(select); - onPrestoBob().executeQuery(insert); - assertThat(onPrestoBob().executeQuery("SHOW GRANTS ON hive.default.test_table")) + onTrinoBob().executeQuery("SET ROLE ALL IN hive"); + onTrinoBob().executeQuery(select); + onTrinoBob().executeQuery(insert); + assertThat(onTrinoBob().executeQuery("SHOW GRANTS ON hive.default.test_table")) .containsOnly(ImmutableList.of( row("alice", "USER", "role1", "ROLE", "hive", "default", "test_table", "SELECT", "NO", null), row("alice", "USER", "role2", "ROLE", "hive", "default", "test_table", "INSERT", "NO", null))); - onPrestoBob().executeQuery("SET ROLE NONE IN hive"); - assertQueryFailure(() -> onPrestoBob().executeQuery(select)) + onTrinoBob().executeQuery("SET ROLE NONE IN hive"); + assertQueryFailure(() -> onTrinoBob().executeQuery(select)) .hasMessageContaining("Access Denied"); - assertQueryFailure(() -> onPrestoBob().executeQuery(insert)) + assertQueryFailure(() -> onTrinoBob().executeQuery(insert)) .hasMessageContaining("Access Denied"); - assertThat(onPrestoBob().executeQuery("SHOW GRANTS ON hive.default.test_table")) + assertThat(onTrinoBob().executeQuery("SHOW GRANTS ON hive.default.test_table")) .containsOnly(ImmutableList.of()); - onPrestoBob().executeQuery("SET ROLE role1 IN hive"); - onPrestoBob().executeQuery(select); - assertQueryFailure(() -> onPrestoBob().executeQuery(insert)) + onTrinoBob().executeQuery("SET ROLE role1 IN hive"); + onTrinoBob().executeQuery(select); + assertQueryFailure(() -> onTrinoBob().executeQuery(insert)) .hasMessageContaining("Access Denied"); - assertThat(onPrestoBob().executeQuery("SHOW GRANTS ON hive.default.test_table")) + assertThat(onTrinoBob().executeQuery("SHOW GRANTS ON hive.default.test_table")) .containsOnly(ImmutableList.of( row("alice", "USER", "role1", "ROLE", "hive", "default", "test_table", "SELECT", "NO", null))); - onPrestoBob().executeQuery("SET ROLE role2 IN hive"); - assertQueryFailure(() -> onPrestoBob().executeQuery(select)) + onTrinoBob().executeQuery("SET ROLE role2 IN hive"); + assertQueryFailure(() -> onTrinoBob().executeQuery(select)) .hasMessageContaining("Access Denied"); - onPrestoBob().executeQuery(insert); - assertThat(onPrestoBob().executeQuery("SHOW GRANTS ON hive.default.test_table")) + onTrinoBob().executeQuery(insert); + assertThat(onTrinoBob().executeQuery("SHOW GRANTS ON hive.default.test_table")) .containsOnly(ImmutableList.of( row("alice", "USER", "role2", "ROLE", "hive", "default", "test_table", "INSERT", "NO", null))); - onPrestoAlice().executeQuery("DROP TABLE hive.default.test_table"); + onTrinoAlice().executeQuery("DROP TABLE hive.default.test_table"); } private static void assertAdminExecute(String query) @@ -790,12 +790,12 @@ private static void assertAdminExecute(String query) onTrino().executeQuery(query); } - private static QueryExecutor onPrestoAlice() + private static QueryExecutor onTrinoAlice() { return connectToTrino("alice@trino"); } - private static QueryExecutor onPrestoBob() + private static QueryExecutor onTrinoBob() { return connectToTrino("bob@trino"); } diff --git a/testing/trino-product-tests/src/main/java/io/trino/tests/product/jdbc/BaseLdapJdbcTest.java b/testing/trino-product-tests/src/main/java/io/trino/tests/product/jdbc/BaseLdapJdbcTest.java index 869c08584868..2932f1ec0d73 100644 --- a/testing/trino-product-tests/src/main/java/io/trino/tests/product/jdbc/BaseLdapJdbcTest.java +++ b/testing/trino-product-tests/src/main/java/io/trino/tests/product/jdbc/BaseLdapJdbcTest.java @@ -58,7 +58,7 @@ public abstract class BaseLdapJdbcTest @Inject @Named("databases.trino.cli_ldap_server_address") - private String prestoServer; + private String trinoServer; @Override public Requirement getRequirements(Configuration configuration) @@ -89,16 +89,16 @@ private Connection getLdapConnection(String name, String password) return DriverManager.getConnection(getLdapUrl(), name, password); } - protected String prestoServer() + protected String trinoServer() { String prefix = "https://"; - checkState(prestoServer.startsWith(prefix), "invalid server address: %s", prestoServer); - return prestoServer.substring(prefix.length()); + checkState(trinoServer.startsWith(prefix), "invalid server address: %s", trinoServer); + return trinoServer.substring(prefix.length()); } protected String getLdapUrl() { - return format(getLdapUrlFormat(), prestoServer(), ldapTruststorePath, ldapTruststorePassword); + return format(getLdapUrlFormat(), trinoServer(), ldapTruststorePath, ldapTruststorePassword); } protected abstract String getLdapUrlFormat(); diff --git a/testing/trino-product-tests/src/main/java/io/trino/tests/product/jdbc/TestLdapTrinoJdbc.java b/testing/trino-product-tests/src/main/java/io/trino/tests/product/jdbc/TestLdapTrinoJdbc.java index 551be50ab413..f98d2fb8fe34 100644 --- a/testing/trino-product-tests/src/main/java/io/trino/tests/product/jdbc/TestLdapTrinoJdbc.java +++ b/testing/trino-product-tests/src/main/java/io/trino/tests/product/jdbc/TestLdapTrinoJdbc.java @@ -128,7 +128,7 @@ public void shouldFailQueryForLdapWithoutPassword() @Test(groups = {LDAP, TRINO_JDBC, PROFILE_SPECIFIC_TESTS}, timeOut = TIMEOUT) public void shouldFailQueryForLdapWithoutSsl() { - assertThatThrownBy(() -> DriverManager.getConnection("jdbc:trino://" + prestoServer(), ldapUserName, ldapUserPassword)) + assertThatThrownBy(() -> DriverManager.getConnection("jdbc:trino://" + trinoServer(), ldapUserName, ldapUserPassword)) .isInstanceOf(SQLException.class) .hasMessageContaining("TLS/SSL is required for authentication with username and password"); } @@ -136,7 +136,7 @@ public void shouldFailQueryForLdapWithoutSsl() @Test(groups = {LDAP, TRINO_JDBC, PROFILE_SPECIFIC_TESTS}, timeOut = TIMEOUT) public void shouldFailForIncorrectTrustStore() { - String url = format("jdbc:trino://%s?SSL=true&SSLTrustStorePath=%s&SSLTrustStorePassword=%s", prestoServer(), ldapTruststorePath, "wrong_password"); + String url = format("jdbc:trino://%s?SSL=true&SSLTrustStorePath=%s&SSLTrustStorePassword=%s", trinoServer(), ldapTruststorePath, "wrong_password"); assertThatThrownBy(() -> DriverManager.getConnection(url, ldapUserName, ldapUserPassword)) .isInstanceOf(SQLException.class) .hasMessageContaining("Error setting up SSL: keystore password was incorrect");