Skip to content

Commit

Permalink
Merge branch 'master' into SNOW-1168512v2
Browse files Browse the repository at this point in the history
  • Loading branch information
sfc-gh-ext-simba-jy authored Aug 21, 2024
2 parents e3be1cf + 940d514 commit 7a2cc1c
Showing 1 changed file with 17 additions and 8 deletions.
25 changes: 17 additions & 8 deletions src/test/java/net/snowflake/client/jdbc/ConnectionIT.java
Original file line number Diff line number Diff line change
Expand Up @@ -459,13 +459,17 @@ public void testConnectUsingKeyPair() throws Exception {
String encodePublicKey2 = Base64.encodeBase64String(publicKey2.getEncoded());
statement.execute(
String.format("alter user %s set rsa_public_key_2='%s'", testUser, encodePublicKey2));
} finally {
try (Connection connection = DriverManager.getConnection(uri, properties);
Statement statement = connection.createStatement()) {
statement.execute("use role accountadmin");
statement.execute(String.format("alter user %s unset rsa_public_key", testUser));
statement.execute(String.format("alter user %s unset rsa_public_key_2", testUser));
}
}

try (Connection connection = DriverManager.getConnection(uri, properties)) {
assertFalse(connection.isClosed());
}

try (Connection connection = getConnection();
Statement statement = connection.createStatement()) {
statement.execute("use role accountadmin");
statement.execute(String.format("alter user %s unset rsa_public_key", testUser));
statement.execute(String.format("alter user %s unset rsa_public_key_2", testUser));
}
}

Expand Down Expand Up @@ -541,8 +545,13 @@ public void testDifferentKeyLength() throws Exception {

// test correct private key one
properties.put("privateKey", privateKey);
try (Connection connection = DriverManager.getConnection(uri, properties);
try (Connection connection = DriverManager.getConnection(uri, properties)) {
assertFalse(connection.isClosed());
}

try (Connection connection = getConnection();
Statement statement = connection.createStatement()) {
statement.execute("use role accountadmin");
statement.execute(String.format("alter user %s unset rsa_public_key", testUser));
}
}
Expand Down

0 comments on commit 7a2cc1c

Please sign in to comment.