Skip to content

Commit

Permalink
Rename product test table result
Browse files Browse the repository at this point in the history
  • Loading branch information
electrum committed Sep 30, 2024
1 parent de4441f commit 42c54a6
Show file tree
Hide file tree
Showing 9 changed files with 25 additions and 25 deletions.
Original file line number Diff line number Diff line change
Expand Up @@ -19,7 +19,7 @@

public final class TpchTableResults
{
public static final SqlResultDescriptor PRESTO_NATION_RESULT = sqlResultDescriptorForResource("table-results/presto-nation.result");
public static final SqlResultDescriptor TRINO_NATION_RESULT = sqlResultDescriptorForResource("table-results/trino-nation.result");

private TpchTableResults()
{
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -35,7 +35,7 @@
import static io.trino.tempto.fulfillment.table.TableRequirements.immutableTable;
import static io.trino.tests.product.TestGroups.CASSANDRA;
import static io.trino.tests.product.TestGroups.PROFILE_SPECIFIC_TESTS;
import static io.trino.tests.product.TpchTableResults.PRESTO_NATION_RESULT;
import static io.trino.tests.product.TpchTableResults.TRINO_NATION_RESULT;
import static io.trino.tests.product.cassandra.CassandraTpchTableDefinitions.CASSANDRA_NATION;
import static io.trino.tests.product.cassandra.CassandraTpchTableDefinitions.CASSANDRA_SUPPLIER;
import static io.trino.tests.product.cassandra.DataTypesTableDefinition.CASSANDRA_ALL_TYPES;
Expand Down Expand Up @@ -87,7 +87,7 @@ public void testSelectNation()
QueryResult queryResult = onTrino()
.executeQuery(sql);

assertThat(queryResult).matches(PRESTO_NATION_RESULT);
assertThat(queryResult).matches(TRINO_NATION_RESULT);
}

@Test(groups = {CASSANDRA, PROFILE_SPECIFIC_TESTS})
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -43,7 +43,7 @@
import static io.trino.tempto.query.QueryExecutor.param;
import static io.trino.testing.TestingNames.randomNameSuffix;
import static io.trino.tests.product.TestGroups.LARGE_QUERY;
import static io.trino.tests.product.TpchTableResults.PRESTO_NATION_RESULT;
import static io.trino.tests.product.TpchTableResults.TRINO_NATION_RESULT;
import static io.trino.tests.product.hive.BucketingType.BUCKETED_DEFAULT;
import static io.trino.tests.product.hive.BucketingType.BUCKETED_V1;
import static io.trino.tests.product.hive.BucketingType.BUCKETED_V2;
Expand Down Expand Up @@ -112,7 +112,7 @@ public void testSelectStar()
String tableName = mutableTableInstanceOf(BUCKETED_NATION).getNameInDatabase();
populateHiveTable(tableName, NATION.getName());

assertThat(onTrino().executeQuery("SELECT * FROM " + tableName)).matches(PRESTO_NATION_RESULT);
assertThat(onTrino().executeQuery("SELECT * FROM " + tableName)).matches(TRINO_NATION_RESULT);
}

@Test(groups = LARGE_QUERY)
Expand Down Expand Up @@ -286,7 +286,7 @@ public void testCreateBucketedTableAsSelect()
// nations has 25 rows and NDV=5 for n_regionkey, setting bucket_count=10 will surely create empty buckets
onTrino().executeQuery(format("CREATE TABLE %s WITH (bucket_count = 10, bucketed_by = ARRAY['n_regionkey']) AS SELECT * FROM %s", tableName, NATION.getName()));

assertThat(onTrino().executeQuery(format("SELECT * FROM %s", tableName))).matches(PRESTO_NATION_RESULT);
assertThat(onTrino().executeQuery(format("SELECT * FROM %s", tableName))).matches(TRINO_NATION_RESULT);
assertThat(onTrino().executeQuery(format("SELECT count(*) FROM %s WHERE n_regionkey=0", tableName))).containsExactlyInOrder(row(5));
}

Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -97,7 +97,7 @@ public void shouldAuthenticateAndExecuteQuery()
try (Connection connection = DriverManager.getConnection(jdbcUrl);
PreparedStatement statement = connection.prepareStatement("SELECT * FROM tpch.tiny.nation");
ResultSet results = statement.executeQuery()) {
assertThat(forResultSet(results)).matches(TpchTableResults.PRESTO_NATION_RESULT);
assertThat(forResultSet(results)).matches(TpchTableResults.TRINO_NATION_RESULT);
}
}

Expand All @@ -109,13 +109,13 @@ public void shouldAuthenticateAfterTokenExpires()
try (Connection connection = DriverManager.getConnection(jdbcUrl);
PreparedStatement statement = connection.prepareStatement("SELECT * FROM tpch.tiny.nation");
ResultSet results = statement.executeQuery()) {
assertThat(forResultSet(results)).matches(TpchTableResults.PRESTO_NATION_RESULT);
assertThat(forResultSet(results)).matches(TpchTableResults.TRINO_NATION_RESULT);
//Wait until the token expires. See: HydraIdentityProvider.TTL_ACCESS_TOKEN_IN_SECONDS
SECONDS.sleep(10);

try (PreparedStatement repeatedStatement = connection.prepareStatement("SELECT * FROM tpch.tiny.nation");
ResultSet repeatedResults = repeatedStatement.executeQuery()) {
assertThat(forResultSet(repeatedResults)).matches(TpchTableResults.PRESTO_NATION_RESULT);
assertThat(forResultSet(repeatedResults)).matches(TpchTableResults.TRINO_NATION_RESULT);
}
}
}
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -102,7 +102,7 @@ public void shouldRefreshTokenAfterTokenExpire()
try (Connection connection = DriverManager.getConnection(jdbcUrl);
PreparedStatement statement = connection.prepareStatement("SELECT * FROM tpch.tiny.nation");
ResultSet results = statement.executeQuery()) {
assertThat(forResultSet(results)).matches(TpchTableResults.PRESTO_NATION_RESULT);
assertThat(forResultSet(results)).matches(TpchTableResults.TRINO_NATION_RESULT);

assertThat(redirectHandler.getRedirectCount()).isEqualTo(1);

Expand All @@ -111,7 +111,7 @@ public void shouldRefreshTokenAfterTokenExpire()

try (PreparedStatement repeatedStatement = connection.prepareStatement("SELECT * FROM tpch.tiny.nation");
ResultSet repeatedResults = repeatedStatement.executeQuery()) {
assertThat(forResultSet(repeatedResults)).matches(TpchTableResults.PRESTO_NATION_RESULT);
assertThat(forResultSet(repeatedResults)).matches(TpchTableResults.TRINO_NATION_RESULT);
}

assertThat(redirectHandler.getRedirectCount()).isEqualTo(1);
Expand All @@ -128,15 +128,15 @@ public void shouldAuthenticateAfterRefreshTokenExpires()
try (Connection connection = DriverManager.getConnection(jdbcUrl);
PreparedStatement statement = connection.prepareStatement("SELECT * FROM tpch.tiny.nation");
ResultSet results = statement.executeQuery()) {
assertThat(forResultSet(results)).matches(TpchTableResults.PRESTO_NATION_RESULT);
assertThat(forResultSet(results)).matches(TpchTableResults.TRINO_NATION_RESULT);

assertThat(redirectHandler.getRedirectCount()).isEqualTo(1);

//Wait until the refresh token expires (15s) . See: HydraIdentityProvider.TTL_REFRESH_TOKEN_IN_SECONDS
SECONDS.sleep(20);
try (PreparedStatement repeatedStatement = connection.prepareStatement("SELECT * FROM tpch.tiny.nation");
ResultSet repeatedResults = repeatedStatement.executeQuery()) {
assertThat(forResultSet(repeatedResults)).matches(TpchTableResults.PRESTO_NATION_RESULT);
assertThat(forResultSet(repeatedResults)).matches(TpchTableResults.TRINO_NATION_RESULT);
}

assertThat(redirectHandler.getRedirectCount()).isEqualTo(2);
Expand All @@ -153,7 +153,7 @@ public void shouldAuthenticateAfterIssuedTokenExpires()
try (Connection connection = DriverManager.getConnection(jdbcUrl);
PreparedStatement statement = connection.prepareStatement("SELECT * FROM tpch.tiny.nation");
ResultSet results = statement.executeQuery()) {
assertThat(forResultSet(results)).matches(TpchTableResults.PRESTO_NATION_RESULT);
assertThat(forResultSet(results)).matches(TpchTableResults.TRINO_NATION_RESULT);

assertThat(redirectHandler.getRedirectCount()).isEqualTo(1);

Expand All @@ -162,7 +162,7 @@ public void shouldAuthenticateAfterIssuedTokenExpires()

try (PreparedStatement repeatedStatement = connection.prepareStatement("SELECT * FROM tpch.tiny.nation");
ResultSet repeatedResults = repeatedStatement.executeQuery()) {
assertThat(forResultSet(repeatedResults)).matches(TpchTableResults.PRESTO_NATION_RESULT);
assertThat(forResultSet(repeatedResults)).matches(TpchTableResults.TRINO_NATION_RESULT);
}

assertThat(redirectHandler.getRedirectCount()).isEqualTo(2);
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -38,7 +38,7 @@
import static io.trino.tempto.fulfillment.table.hive.tpch.TpchTableDefinitions.NATION;
import static io.trino.tempto.internal.convention.SqlResultDescriptor.sqlResultDescriptorForResource;
import static io.trino.tests.product.TestGroups.JDBC;
import static io.trino.tests.product.TpchTableResults.PRESTO_NATION_RESULT;
import static io.trino.tests.product.TpchTableResults.TRINO_NATION_RESULT;
import static io.trino.tests.product.utils.JdbcDriverUtils.getSessionProperty;
import static io.trino.tests.product.utils.JdbcDriverUtils.resetSessionProperty;
import static io.trino.tests.product.utils.JdbcDriverUtils.setSessionProperty;
Expand Down Expand Up @@ -68,7 +68,7 @@ public void shouldExecuteQuery()
{
try (Statement statement = connection().createStatement()) {
QueryResult result = queryResult(statement, "select * from hive.default.nation");
assertThat(result).matches(PRESTO_NATION_RESULT);
assertThat(result).matches(TRINO_NATION_RESULT);
}
}

Expand All @@ -85,7 +85,7 @@ public void shouldInsertSelectQuery()
.isEqualTo(25);
}

assertThat(onTrino().executeQuery("SELECT * FROM " + tableNameInDatabase)).matches(PRESTO_NATION_RESULT);
assertThat(onTrino().executeQuery("SELECT * FROM " + tableNameInDatabase)).matches(TRINO_NATION_RESULT);
}

@Test(groups = JDBC)
Expand All @@ -97,7 +97,7 @@ public void shouldExecuteQueryWithSelectedCatalogAndSchema()
connection().setSchema("default");
try (Statement statement = connection().createStatement()) {
QueryResult result = queryResult(statement, "select * from nation");
assertThat(result).matches(PRESTO_NATION_RESULT);
assertThat(result).matches(TRINO_NATION_RESULT);
}
}

Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -80,7 +80,7 @@ public void testSelectConstrainedDelegationKerberos()
try (Connection connection = DriverManager.getConnection(jdbcUrl, driverProperties);
PreparedStatement statement = connection.prepareStatement("SELECT * FROM tpch.tiny.nation");
ResultSet results = statement.executeQuery()) {
assertThat(forResultSet(results)).matches(TpchTableResults.PRESTO_NATION_RESULT);
assertThat(forResultSet(results)).matches(TpchTableResults.TRINO_NATION_RESULT);
}
finally {
credential.dispose();
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -32,7 +32,7 @@
import static io.trino.tests.product.TestGroups.LDAP_MULTIPLE_BINDS;
import static io.trino.tests.product.TestGroups.PROFILE_SPECIFIC_TESTS;
import static io.trino.tests.product.TestGroups.TRINO_JDBC;
import static io.trino.tests.product.TpchTableResults.PRESTO_NATION_RESULT;
import static io.trino.tests.product.TpchTableResults.TRINO_NATION_RESULT;
import static java.lang.String.format;
import static org.assertj.core.api.Assertions.assertThat;
import static org.assertj.core.api.Assertions.assertThatThrownBy;
Expand All @@ -59,7 +59,7 @@ protected String getLdapUrlFormat()
public void shouldRunQueryWithLdap()
throws SQLException
{
assertThat(executeLdapQuery(NATION_SELECT_ALL_QUERY, ldapUserName, ldapUserPassword)).matches(PRESTO_NATION_RESULT);
assertThat(executeLdapQuery(NATION_SELECT_ALL_QUERY, ldapUserName, ldapUserPassword)).matches(TRINO_NATION_RESULT);
}

@Requires(ImmutableNationTable.class)
Expand All @@ -68,7 +68,7 @@ public void shouldRunQueryWithAlternativeBind()
throws SQLException
{
String name = USER_IN_AMERICA.getAttributes().get("cn");
assertThat(executeLdapQuery(NATION_SELECT_ALL_QUERY, name, ldapUserPassword)).matches(PRESTO_NATION_RESULT);
assertThat(executeLdapQuery(NATION_SELECT_ALL_QUERY, name, ldapUserPassword)).matches(TRINO_NATION_RESULT);
}

@Test(groups = {LDAP, TRINO_JDBC, PROFILE_SPECIFIC_TESTS}, timeOut = TIMEOUT)
Expand Down Expand Up @@ -153,15 +153,15 @@ public void shouldFailForUserWithColon()
public void shouldRunQueryWithFileAuthenticator()
throws SQLException
{
assertThat(executeLdapQuery(NATION_SELECT_ALL_QUERY, ldapUserName, fileUserPassword)).matches(PRESTO_NATION_RESULT);
assertThat(executeLdapQuery(NATION_SELECT_ALL_QUERY, ldapUserName, fileUserPassword)).matches(TRINO_NATION_RESULT);
}

@Requires(ImmutableNationTable.class)
@Test(groups = {LDAP_AND_FILE, TRINO_JDBC, PROFILE_SPECIFIC_TESTS}, timeOut = TIMEOUT)
public void shouldRunQueryForAnotherUserWithOnlyFileAuthenticator()
throws SQLException
{
assertThat(executeLdapQuery(NATION_SELECT_ALL_QUERY, "OnlyFileUser", onlyFileUserPassword)).matches(PRESTO_NATION_RESULT);
assertThat(executeLdapQuery(NATION_SELECT_ALL_QUERY, "OnlyFileUser", onlyFileUserPassword)).matches(TRINO_NATION_RESULT);
}

private void expectQueryToFailForUserNotInGroup(String user)
Expand Down

0 comments on commit 42c54a6

Please sign in to comment.