Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Make a snowflake role optional in test #23578

Merged
merged 1 commit into from
Sep 27, 2024
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
Original file line number Diff line number Diff line change
Expand Up @@ -38,13 +38,14 @@ private SnowflakeQueryRunner() {}

public static Builder builder()
{
return new Builder()
Builder builder = new Builder()
.addConnectorProperty("connection-url", TestingSnowflakeServer.TEST_URL)
.addConnectorProperty("connection-user", TestingSnowflakeServer.TEST_USER)
.addConnectorProperty("connection-password", TestingSnowflakeServer.TEST_PASSWORD)
.addConnectorProperty("snowflake.database", TestingSnowflakeServer.TEST_DATABASE)
.addConnectorProperty("snowflake.role", TestingSnowflakeServer.TEST_ROLE)
.addConnectorProperty("snowflake.warehouse", TestingSnowflakeServer.TEST_WAREHOUSE);
TestingSnowflakeServer.TEST_ROLE.ifPresent(role -> builder.addConnectorProperty("snowflake.role", role));
return builder;
}

public static final class Builder
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -19,6 +19,7 @@
import java.sql.DriverManager;
import java.sql.SQLException;
import java.sql.Statement;
import java.util.Optional;
import java.util.Properties;

import static io.trino.plugin.snowflake.SnowflakeClientModule.setOutputProperties;
Expand All @@ -33,7 +34,7 @@ private TestingSnowflakeServer() {}
public static final String TEST_PASSWORD = requiredNonEmptySystemProperty("snowflake.test.server.password");
public static final String TEST_DATABASE = requiredNonEmptySystemProperty("snowflake.test.server.database");
public static final String TEST_WAREHOUSE = requiredNonEmptySystemProperty("snowflake.test.server.warehouse");
public static final String TEST_ROLE = requiredNonEmptySystemProperty("snowflake.test.server.role");
public static final Optional<String> TEST_ROLE = Optional.ofNullable(System.getProperty("snowflake.test.server.role"));
public static final String TEST_SCHEMA = "tpch";

public static void execute(@Language("SQL") String sql)
Expand All @@ -60,7 +61,7 @@ private static Properties getProperties()
properties.setProperty("db", TEST_DATABASE);
properties.setProperty("schema", TEST_SCHEMA);
properties.setProperty("warehouse", TEST_WAREHOUSE);
properties.setProperty("role", TEST_ROLE);
TEST_ROLE.ifPresent(role -> properties.setProperty("role", role));
setOutputProperties(properties);
return properties;
}
Expand Down