-
Notifications
You must be signed in to change notification settings - Fork 2
Expand file tree
/
Copy pathmanager_test.go
More file actions
46 lines (38 loc) · 1.01 KB
/
manager_test.go
File metadata and controls
46 lines (38 loc) · 1.01 KB
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
package zkmanager
import (
"github.com/samuel/go-zookeeper/zk"
"testing"
"time"
)
// TODO: Test Shutdown
// TODO: Test Add
// TODO: Test Update
// TODO: Test Remove
// TODO: Test Register
// TODO: Test Unregister
// TODO: Test Watch
// TODO: Test Event notifications, nodes added/removed
// TODO: Test watches are put back in place if session expires
// TODO: Test cache building
// TODO: Test Connect
func TestCreatesDefaultPaths(t *testing.T) {
multiCalled := false
eChan := make(chan zk.Event)
zkconn := &TestConnection{
MultiFunc: func(ops zk.MultiOps) error {
// TODO: should inspect these for a more valid test
if len(ops.Create) != 4 {
t.Fatal("Should be creating 4 paths when creating default paths")
}
multiCalled = true
return nil
},
}
factory = func(servers []string, recvTimeout time.Duration) (ZkConnection, <-chan zk.Event, error) {
return zkconn, eChan, nil
}
NewZookeeperServiceManager("foo", 1*time.Second)
if !multiCalled {
t.Fatal("Did not create default paths")
}
}