Skip to content

Commit

Permalink
Add more tests to cover some partial hits
Browse files Browse the repository at this point in the history
  • Loading branch information
sfc-gh-ext-simba-jl committed Oct 19, 2023
1 parent e5bee13 commit 470e8c0
Show file tree
Hide file tree
Showing 2 changed files with 34 additions and 0 deletions.
Original file line number Diff line number Diff line change
Expand Up @@ -273,4 +273,27 @@ public void testSizeOfHttpClientMapWithGzipAndUserAgentSuffix() {
// Assert there are 3 entries because userAgentSuffix has changed
assertEquals(3, HttpUtil.httpClient.size());
}

@Test
public void testNullAndEmptyProxySettingsForS3() {
HttpClientSettingsKey testKey =
new HttpClientSettingsKey(
OCSPMode.FAIL_OPEN,
null,
443,
null,
null,
null,
"",
"",
false);
ClientConfiguration clientConfig = new ClientConfiguration();
HttpUtil.setProxyForS3(testKey, clientConfig);
assertEquals(Protocol.HTTP, clientConfig.getProxyProtocol());
assertEquals("", clientConfig.getProxyHost());
assertEquals(443, clientConfig.getProxyPort());
assertEquals("", clientConfig.getNonProxyHosts());
assertNull(clientConfig.getProxyUsername());
assertNull(clientConfig.getProxyPassword());
}
}
Original file line number Diff line number Diff line change
Expand Up @@ -416,6 +416,17 @@ public void testGetPropertyInfo() throws SQLException {
"server URL in form of <protocol>://<host or domain>:<port number>/<path of resource>",
info[0].description);

// Test with null URL and no properties. ServerURL is needed.
url = null;
props = new Properties();
driver = DriverManager.getDriver("jdbc:snowflake://snowflake.reg.local:8082");
info = driver.getPropertyInfo(url, props);
assertEquals(1, info.length);
assertEquals("serverURL", info[0].name);
assertEquals(
"server URL in form of <protocol>://<host or domain>:<port number>/<path of resource>",
info[0].description);

// Test with URL that requires username and password.
url = "jdbc:snowflake://snowflake.reg.local:8082";
info = driver.getPropertyInfo(url, props);
Expand Down

0 comments on commit 470e8c0

Please sign in to comment.