-
Notifications
You must be signed in to change notification settings - Fork 39
/
Copy pathdriver_test.go
59 lines (56 loc) · 1.78 KB
/
driver_test.go
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
package impala
import (
"io/ioutil"
"testing"
)
func TestParseURI(t *testing.T) {
tests := []struct {
in string
out Options
}{
{
"impala://localhost",
Options{Host: "localhost", Port: "21050", BatchSize: 1024, BufferSize: 4096, LogOut: ioutil.Discard},
},
{
"impala://localhost:21000",
Options{Host: "localhost", Port: "21000", BatchSize: 1024, BufferSize: 4096, LogOut: ioutil.Discard},
},
{
"impala://admin@localhost",
Options{Host: "localhost", Port: "21050", Username: "admin", BatchSize: 1024, BufferSize: 4096, LogOut: ioutil.Discard},
},
{
"impala://admin:password@localhost",
Options{Host: "localhost", Port: "21050", Username: "admin", Password: "password", BatchSize: 1024, BufferSize: 4096, LogOut: ioutil.Discard},
},
{
"impala://admin:p%40ssw0rd@localhost",
Options{Host: "localhost", Port: "21050", Username: "admin", Password: "p@ssw0rd", BatchSize: 1024, BufferSize: 4096, LogOut: ioutil.Discard},
},
{
"impala://admin:p%40ssw0rd@localhost?auth=ldap",
Options{Host: "localhost", Port: "21050", Username: "admin", Password: "p@ssw0rd", UseLDAP: true, BatchSize: 1024, BufferSize: 4096, LogOut: ioutil.Discard},
},
{
"impala://localhost?tls=true&ca-cert=/etc/ca.crt",
Options{Host: "localhost", Port: "21050", UseTLS: true, CACertPath: "/etc/ca.crt", BatchSize: 1024, BufferSize: 4096, LogOut: ioutil.Discard},
},
{
"impala://localhost?batch-size=2048&buffer-size=2048",
Options{Host: "localhost", Port: "21050", BatchSize: 2048, BufferSize: 2048, LogOut: ioutil.Discard},
},
}
for _, tt := range tests {
t.Run(tt.in, func(t *testing.T) {
opts, err := parseURI(tt.in)
if err != nil {
t.Error(err)
return
}
if *opts != tt.out {
t.Errorf("got: %v, want: %v", opts, tt.out)
}
})
}
}