Skip to content

Commit

Permalink
SNOW-933005 Fix Wrong Error Code Issues in testProdConnectivity and …
Browse files Browse the repository at this point in the history
…testInsecureMode (#1526)

* bad request error(390400) in connectionIT

* fix testProdConnectivity

* reformat
  • Loading branch information
sfc-gh-bli authored Oct 9, 2023
1 parent 334e2d0 commit e14dea1
Showing 1 changed file with 7 additions and 5 deletions.
12 changes: 7 additions & 5 deletions src/test/java/net/snowflake/client/jdbc/ConnectionIT.java
Original file line number Diff line number Diff line change
Expand Up @@ -4,8 +4,7 @@
package net.snowflake.client.jdbc;

import static net.snowflake.client.core.SessionUtil.CLIENT_SESSION_KEEP_ALIVE_HEARTBEAT_FREQUENCY;
import static org.hamcrest.CoreMatchers.equalTo;
import static org.hamcrest.CoreMatchers.is;
import static org.hamcrest.CoreMatchers.*;
import static org.hamcrest.MatcherAssert.assertThat;
import static org.junit.Assert.*;
import static org.junit.Assume.assumeTrue;
Expand Down Expand Up @@ -136,7 +135,8 @@ public void testProdConnectivity() throws SQLException {
DriverManager.getConnection(url, properties);
fail();
} catch (SQLException e) {
assertThat(e.getErrorCode(), is(INVALID_CONNECTION_INFO_CODE));
assertThat(
e.getErrorCode(), anyOf(is(INVALID_CONNECTION_INFO_CODE), is(BAD_REQUEST_GS_CODE)));
}
}
}
Expand Down Expand Up @@ -545,7 +545,8 @@ public void testInsecureMode() throws SQLException {
DriverManager.getConnection(deploymentUrl, properties);
fail();
} catch (SQLException e) {
assertThat(e.getErrorCode(), is(INVALID_CONNECTION_INFO_CODE));
assertThat(
e.getErrorCode(), anyOf(is(INVALID_CONNECTION_INFO_CODE), is(BAD_REQUEST_GS_CODE)));
}

deploymentUrl = "jdbc:snowflake://sfcsupport.snowflakecomputing.com?insecureMode=true";
Expand All @@ -559,7 +560,8 @@ public void testInsecureMode() throws SQLException {
DriverManager.getConnection(deploymentUrl, properties);
fail();
} catch (SQLException e) {
assertThat(e.getErrorCode(), is(INVALID_CONNECTION_INFO_CODE));
assertThat(
e.getErrorCode(), anyOf(is(INVALID_CONNECTION_INFO_CODE), is(BAD_REQUEST_GS_CODE)));
}
}

Expand Down

0 comments on commit e14dea1

Please sign in to comment.