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

NO-SNOW: fix test failures during releasing #663

Merged
merged 2 commits into from
Jan 15, 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 @@ -28,6 +28,9 @@ public static class Builder {
// Allows client to override some default parameter values
private Map<String, Object> parameterOverrides;

// Indicates whether it's under test mode
private boolean isTestMode;

private Builder(String name) {
this.name = name;
}
Expand All @@ -42,6 +45,11 @@ public Builder setParameterOverrides(Map<String, Object> parameterOverrides) {
return this;
}

public Builder setIsTestMode(boolean isTestMode) {
this.isTestMode = isTestMode;
return this;
}

public SnowflakeStreamingIngestClient build() {
Utils.assertStringNotNullOrEmpty("client name", this.name);
Utils.assertNotNull("connection properties", this.prop);
Expand All @@ -50,7 +58,7 @@ public SnowflakeStreamingIngestClient build() {
SnowflakeURL accountURL = new SnowflakeURL(prop.getProperty(Constants.ACCOUNT_URL));

return new SnowflakeStreamingIngestClientInternal<>(
this.name, accountURL, prop, this.parameterOverrides);
this.name, accountURL, prop, this.parameterOverrides, this.isTestMode);
}
}
}
Original file line number Diff line number Diff line change
Expand Up @@ -227,13 +227,15 @@ public class SnowflakeStreamingIngestClientInternal<T> implements SnowflakeStrea
* @param accountURL Snowflake account url
* @param prop connection properties
* @param parameterOverrides map of parameters to override for this client
* @param isTestMode indicates whether it's under test mode
*/
public SnowflakeStreamingIngestClientInternal(
String name,
SnowflakeURL accountURL,
Properties prop,
Map<String, Object> parameterOverrides) {
this(name, accountURL, prop, null, false, null, parameterOverrides);
Map<String, Object> parameterOverrides,
boolean isTestMode) {
this(name, accountURL, prop, null, isTestMode, null, parameterOverrides);
}

/*** Constructor for TEST ONLY
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -158,6 +158,7 @@ public void testConstructorParameters() throws Exception {
SnowflakeStreamingIngestClientFactory.builder("client")
.setProperties(prop)
.setParameterOverrides(parameterMap)
.setIsTestMode(true)
.build();

Assert.assertEquals("client", client.getName());
Expand Down Expand Up @@ -263,7 +264,10 @@ public void testClientFactorySuccess() throws Exception {
prop.put(ROLE, TestUtils.getRole());

SnowflakeStreamingIngestClient client =
SnowflakeStreamingIngestClientFactory.builder("client").setProperties(prop).build();
SnowflakeStreamingIngestClientFactory.builder("client")
.setProperties(prop)
.setIsTestMode(true)
.build();

Assert.assertEquals("client", client.getName());
Assert.assertFalse(client.isClosed());
Expand Down
Loading