@@ -33,22 +33,27 @@ func TestDSN(t *testing.T) {
33
33
password string
34
34
browserAuth bool
35
35
region ,
36
- role string
36
+ role ,
37
+ host string
37
38
}
38
39
tests := []struct {
39
40
name string
40
41
args args
41
42
want string
42
43
wantErr bool
43
44
}{
44
- {"simple" , args {"acct" , "user" , "pass" , false , "region" , "role" },
45
+ {"simple" , args {"acct" , "user" , "pass" , false , "region" , "role" , "" },
45
46
"user:pass@acct.region.snowflakecomputing.com:443?ocspFailOpen=true®ion=region&role=role&validateDefaultParameters=true" , false },
46
- {"us-west-2 special case" , args {"acct2" , "user2" , "pass2" , false , "us-west-2" , "role2" },
47
+ {"us-west-2 special case" , args {"acct2" , "user2" , "pass2" , false , "us-west-2" , "role2" , "" },
47
48
"user2:pass2@acct2.snowflakecomputing.com:443?ocspFailOpen=true&role=role2&validateDefaultParameters=true" , false },
49
+ {"customhostwregion" , args {"acct3" , "user3" , "pass3" , false , "" , "role3" , "zha123.us-east-1.privatelink.snowflakecomputing.com" },
50
+ "user3:pass3@zha123.us-east-1.privatelink.snowflakecomputing.com:443?account=acct3&ocspFailOpen=true&role=role3&validateDefaultParameters=true" , false },
51
+ {"customhostignoreregion" , args {"acct4" , "user4" , "pass4" , false , "fakeregion" , "role4" , "zha1234.us-east-1.privatelink.snowflakecomputing.com" },
52
+ "user4:pass4@zha1234.us-east-1.privatelink.snowflakecomputing.com:443?account=acct4&ocspFailOpen=true&role=role4&validateDefaultParameters=true" , false },
48
53
}
49
54
for _ , tt := range tests {
50
55
t .Run (tt .name , func (t * testing.T ) {
51
- got , err := provider .DSN (tt .args .account , tt .args .user , tt .args .password , tt .args .browserAuth , "" , "" , "" , "" , tt .args .region , tt .args .role )
56
+ got , err := provider .DSN (tt .args .account , tt .args .user , tt .args .password , tt .args .browserAuth , "" , "" , "" , "" , tt .args .region , tt .args .role , tt . args . host )
52
57
if (err != nil ) != tt .wantErr {
53
58
t .Errorf ("DSN() error = %v, wantErr %v" , err , tt .wantErr )
54
59
return
@@ -84,7 +89,7 @@ func TestOAuthDSN(t *testing.T) {
84
89
}
85
90
for _ , tt := range tests {
86
91
t .Run (tt .name , func (t * testing.T ) {
87
- got , err := provider .DSN (tt .args .account , tt .args .user , "" , false , "" , "" , "" , tt .args .oauthAccessToken , tt .args .region , tt .args .role )
92
+ got , err := provider .DSN (tt .args .account , tt .args .user , "" , false , "" , "" , "" , tt .args .oauthAccessToken , tt .args .region , tt .args .role , "" )
88
93
89
94
if (err != nil ) != tt .wantErr {
90
95
t .Errorf ("DSN() error = %v, dsn = %v, wantErr %v" , err , got , tt .wantErr )
0 commit comments