Skip to content

Commit

Permalink
Apply PR suggestions
Browse files Browse the repository at this point in the history
  • Loading branch information
sfc-gh-jmartinezramirez committed Apr 4, 2024
1 parent 1b2204b commit f6716ca
Show file tree
Hide file tree
Showing 2 changed files with 4 additions and 5 deletions.
7 changes: 3 additions & 4 deletions Snowflake.Data.Tests/IntegrationTests/SFConnectionIT.cs
Original file line number Diff line number Diff line change
Expand Up @@ -1554,7 +1554,7 @@ public void TestNonProxyHostShouldBypassProxyServer(string regexHost, string pro
using (var conn = new SnowflakeDbConnection())
{
// Arrange
var host = ResolveHostToUseFromTestConfig(ConnectionString);
var host = this.ResolveHost();
var nonProxyHosts = string.Format(regexHost, $"{host}");
conn.ConnectionString =
$"{ConnectionString}USEPROXY=true;PROXYHOST={proxyHost};NONPROXYHOSTS={nonProxyHosts};PROXYPORT=3128;";
Expand All @@ -1563,7 +1563,7 @@ public void TestNonProxyHostShouldBypassProxyServer(string regexHost, string pro
conn.Open();

// Assert
// If the connection is open, it indicates that the server proxy was bypassed.
// The connection would fail to open if the web proxy would be used because the proxy is configured to a non-existent host.
Assert.AreEqual(ConnectionState.Open, conn.State);
}
}
Expand All @@ -1585,8 +1585,7 @@ public void TestNonProxyHostShouldNotBypassProxyServer(string regexHost, string
$"{ConnectionString}connection_timeout=5;USEPROXY=true;PROXYHOST={proxyHost};NONPROXYHOSTS={nonProxyHosts};PROXYPORT=3128;";

// Act/Assert
// If the nonproxyhosts property fails to bypass the server, the proxy will be use but it will return a exception
// because is not configure in the testing environment so the exception is used to verify that was not bypass.
// The connection would fail to open if the web proxy would be used because the proxy is configured to a non-existent host.
var exception = Assert.Throws<SnowflakeDbException>(() => conn.Open());

// Assert
Expand Down
2 changes: 1 addition & 1 deletion Snowflake.Data.Tests/SFBaseTest.cs
Original file line number Diff line number Diff line change
Expand Up @@ -147,7 +147,7 @@ public SFBaseTestAsync()

protected TestConfig testConfig { get; }

protected string ResolveHostToUseFromTestConfig()
protected string ResolveHost()
{
return testConfig.host ?? $"{testConfig.account}.snowflakecomputing.com";
}
Expand Down

0 comments on commit f6716ca

Please sign in to comment.