-
Notifications
You must be signed in to change notification settings - Fork 127
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
Removed proxy parameters. Instead, the environment variables should b…
…e used. HTTP_PROXY, HTTPS_PROXY and NO_PROXY
- Loading branch information
Showing
7 changed files
with
3 additions
and
127 deletions.
There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
|
@@ -4,8 +4,6 @@ package gosnowflake | |
|
||
import ( | ||
"database/sql/driver" | ||
"fmt" | ||
"net/url" | ||
"testing" | ||
"time" | ||
) | ||
|
@@ -131,71 +129,3 @@ func TestToNamedValues(t *testing.T) { | |
} | ||
} | ||
} | ||
|
||
type tcProxyURL struct { | ||
proxyHost string | ||
proxyPort int | ||
proxyUser string | ||
proxyPassword string | ||
output *url.URL | ||
err error | ||
} | ||
|
||
func TestProxyURL(t *testing.T) { | ||
var genProxyURL = func(urlStr string) *url.URL { | ||
ret, err := url.Parse(urlStr) | ||
if err != nil { | ||
panic(fmt.Sprintf("failed to parse URL: %v", urlStr)) | ||
} | ||
return ret | ||
} | ||
testcases := []tcProxyURL{ | ||
{ | ||
proxyHost: "proxy.host.com", | ||
proxyPort: 123, | ||
output: genProxyURL("http://proxy.host.com:123"), | ||
}, | ||
{ | ||
proxyHost: "proxy.host.com", | ||
proxyPort: 123, | ||
proxyUser: "u", | ||
proxyPassword: "p", | ||
output: genProxyURL("http://u:[email protected]:123"), | ||
}, | ||
{ | ||
proxyHost: "proxy.host.com", | ||
proxyPort: 123, | ||
proxyUser: "u", | ||
output: genProxyURL("http://u:@proxy.host.com:123"), | ||
}, | ||
{ | ||
proxyHost: "proxy.host.com", | ||
output: nil, | ||
}, | ||
{ | ||
proxyPort: 456, | ||
output: nil, | ||
}, | ||
{ | ||
output: nil, | ||
}, | ||
} | ||
for _, test := range testcases { | ||
a, err := proxyURL(test.proxyHost, test.proxyPort, test.proxyUser, test.proxyPassword) | ||
if err != nil && test.err == nil { | ||
t.Errorf("unexpected error. err: %v, input: %v", err, test) | ||
} | ||
if err == nil && test.err != nil { | ||
t.Errorf("error is expected. err: %v, input: %v", test.err, test) | ||
} | ||
if a == nil && test.output != nil || a != nil && test.output == nil { | ||
t.Errorf("failed to get proxy URL. host: %v, port: %v, user: %v, password: %v, expected: %v, got: %v", | ||
test.proxyHost, test.proxyPort, test.proxyUser, test.proxyPassword, test.output, a) | ||
} | ||
|
||
if a != nil && test.output != nil && test.output.String() != a.String() { | ||
t.Errorf("failed to get proxy URL. host: %v, port: %v, user: %v, password: %v, expected: %v, got: %v", | ||
test.proxyHost, test.proxyPort, test.proxyUser, test.proxyPassword, test.output, a) | ||
} | ||
} | ||
} |