Skip to content

Commit

Permalink
NO-SNOW Ignore OAuth test (snowflakedb#906)
Browse files Browse the repository at this point in the history
(cherry picked from commit 30d2e8b)
  • Loading branch information
sfc-gh-mbobowski authored and sangeet259 committed Aug 22, 2024
1 parent 9014f00 commit b3bd81d
Show file tree
Hide file tree
Showing 8 changed files with 21 additions and 7 deletions.
5 changes: 5 additions & 0 deletions src/test/java/com/snowflake/kafka/connector/ConnectorIT.java
Original file line number Diff line number Diff line change
Expand Up @@ -11,6 +11,7 @@
import java.util.concurrent.Executors;
import org.apache.kafka.common.config.Config;
import org.apache.kafka.common.config.ConfigValue;
import org.junit.Ignore;
import org.junit.Test;

public class ConnectorIT {
Expand Down Expand Up @@ -139,6 +140,7 @@ public void testValidateCorrectConfig() {
}

@Test
@Ignore("OAuth tests are temporary disabled")
public void testValidateCorrectConfigWithOAuth() {
Map<String, ConfigValue> validateMap = toValidateMap(getCorrectConfigWithOAuth());
assertPropHasError(validateMap, new String[] {});
Expand Down Expand Up @@ -209,6 +211,7 @@ public void testValidateNullPasswordConfig() {
}

@Test
@Ignore("OAuth tests are temporary disabled")
public void testValidateNullOAuthClientIdConfig() {
Map<String, String> config = getCorrectConfigWithOAuth();
config.remove(SnowflakeSinkConnectorConfig.OAUTH_CLIENT_ID);
Expand All @@ -217,6 +220,7 @@ public void testValidateNullOAuthClientIdConfig() {
}

@Test
@Ignore("OAuth tests are temporary disabled")
public void testValidateNullOAuthClientSecretConfig() {
Map<String, String> config = getCorrectConfigWithOAuth();
config.remove(SnowflakeSinkConnectorConfig.OAUTH_CLIENT_SECRET);
Expand All @@ -226,6 +230,7 @@ public void testValidateNullOAuthClientSecretConfig() {
}

@Test
@Ignore("OAuth tests are temporary disabled")
public void testValidateNullOAuthRefreshTokenConfig() {
Map<String, String> config = getCorrectConfigWithOAuth();
config.remove(SnowflakeSinkConnectorConfig.OAUTH_REFRESH_TOKEN);
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -68,7 +68,9 @@ public void afterEach() {
}

private static Stream<Arguments> oAuthAndSingleBufferParameters() {
return TestUtils.nBooleanProduct(2);
return Stream.of(Arguments.of(false, false), Arguments.of(false, true));
// OAuth tests are temporary disabled
// return TestUtils.nBooleanProduct(2);
}

@ParameterizedTest(name = "useOAuth: {0}, useSingleBuffer: {1}")
Expand Down
2 changes: 2 additions & 0 deletions src/test/java/com/snowflake/kafka/connector/UtilsTest.java
Original file line number Diff line number Diff line change
Expand Up @@ -6,6 +6,7 @@
import java.util.HashMap;
import java.util.Map;
import org.junit.Assert;
import org.junit.Ignore;
import org.junit.Rule;
import org.junit.Test;
import org.junit.contrib.java.lang.system.EnvironmentVariables;
Expand Down Expand Up @@ -283,6 +284,7 @@ public void testGetExceptionMessage() throws Exception {
}

@Test
@Ignore("OAuth tests are temporary disabled")
public void testGetSnowflakeOAuthAccessToken() {
Map<String, String> config = TestUtils.getConfForStreamingWithOAuth();
if (config != null) {
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -34,6 +34,7 @@
import org.apache.kafka.connect.sink.SinkRecord;
import org.junit.jupiter.api.AfterEach;
import org.junit.jupiter.api.Assertions;
import org.junit.jupiter.api.Disabled;
import org.junit.jupiter.api.Test;
import org.junit.jupiter.params.ParameterizedTest;
import org.junit.jupiter.params.provider.ValueSource;
Expand All @@ -56,6 +57,7 @@ public void testEncryptedKey() {
}

@Test
@Disabled("OAuth tests are temporary disabled")
public void testOAuthAZ() {
Map<String, String> confWithOAuth = TestUtils.getConfWithOAuth();
assert confWithOAuth.containsKey(Utils.SF_OAUTH_CLIENT_ID);
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -31,13 +31,11 @@
public class DirectStreamingClientHandlerTest {
private StreamingClientHandler streamingClientHandler;
private Map<String, String> connectorConfig;
private Map<String, String> connectorConfigWithOAuth;

@Before
public void setup() {
this.streamingClientHandler = new DirectStreamingClientHandler();
this.connectorConfig = TestUtils.getConfForStreaming();
this.connectorConfigWithOAuth = TestUtils.getConfForStreamingWithOAuth();
}

@Test
Expand Down Expand Up @@ -67,9 +65,10 @@ public void testCreateClient() throws Exception {
@Test
@Ignore // TODO: Remove ignore after SNOW-859929 is released
public void testCreateOAuthClient() {
if (this.connectorConfigWithOAuth != null) {
Map<String, String> connectorConfigWithOAuth = TestUtils.getConfForStreamingWithOAuth();
if (connectorConfigWithOAuth != null) {
this.streamingClientHandler.createClient(
new StreamingClientProperties(this.connectorConfigWithOAuth));
new StreamingClientProperties(connectorConfigWithOAuth));
}
}

Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -79,7 +79,9 @@ private static Stream<Arguments> singleBufferParameters() {
}

private static Stream<Arguments> oAuthAndSingleBufferParameters() {
return TestUtils.nBooleanProduct(2);
return Stream.of(Arguments.of(false, false), Arguments.of(false, true));
// OAuth tests are temporary disabled
// return TestUtils.nBooleanProduct(2);
}

@ParameterizedTest(name = "useOAuth: {0}, useSingleBuffer: {1}")
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -22,13 +22,15 @@
import java.util.Map;
import net.snowflake.ingest.streaming.SnowflakeStreamingIngestClient;
import org.junit.jupiter.api.Assertions;
import org.junit.jupiter.api.Disabled;
import org.junit.jupiter.api.Test;
import org.junit.jupiter.params.ParameterizedTest;
import org.junit.jupiter.params.provider.ValueSource;

public class StreamingClientProviderIT {

@Test
@Disabled("CI flaky")
public void getClient_forOptimizationEnabled_returnSameClient() {
// given
Map<String, String> clientConfig = getClientConfig(true);
Expand Down
2 changes: 1 addition & 1 deletion src/test/resources/log4j.properties
Original file line number Diff line number Diff line change
@@ -1,4 +1,4 @@
log4j.rootLogger=ALL, STDOUT, file
log4j.rootLogger=INFO, STDOUT, file
log4j.logger.deng=INFO
log4j.appender.STDOUT=org.apache.log4j.ConsoleAppender
log4j.appender.STDOUT.layout=org.apache.log4j.PatternLayout
Expand Down

0 comments on commit b3bd81d

Please sign in to comment.