-
Notifications
You must be signed in to change notification settings - Fork 1
Expand file tree
/
Copy pathchroot_test.go
More file actions
50 lines (40 loc) · 966 Bytes
/
chroot_test.go
File metadata and controls
50 lines (40 loc) · 966 Bytes
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
package zkclient
import (
"testing"
"github.com/funkygao/assert"
)
func TestZkParseConnStr(t *testing.T) {
fixtures := assert.Fixtures{
assert.Fixture{
Expected: "/helix/root",
Input: "127.0.0.1:2181,127.1.1.1:2191/helix/root",
},
assert.Fixture{
Expected: "/helix/root",
Input: "127.0.0.1:2181,127.1.1.1:2191/helix/root/",
},
assert.Fixture{
Expected: "/helix/root",
Input: "127.0.0.1:2181,127.1.1.1:2191/helix/root/ ",
},
assert.Fixture{
Expected: "",
Input: "127.0.0.1:2181,127.1.1.1:2191",
},
assert.Fixture{
Expected: "/abc",
Input: "127.0.0.1:2181/abc/",
},
assert.Fixture{
Expected: "/abc",
Input: "127.0.0.1:2181/abc",
},
}
for _, f := range fixtures {
servers, chroot, err := parseZkConnStr(f.Input.(string))
assert.Equal(t, f.Expected.(string), chroot)
assert.Equal(t, nil, err)
assert.Equal(t, true, len(servers) > 0)
t.Logf("%+v", servers)
}
}