Skip to content
Snippets Groups Projects
Commit 58ce465b authored by wangwx's avatar wangwx
Browse files

fix ut error

parent 887956da
No related branches found
No related tags found
No related merge requests found
......@@ -63,7 +63,6 @@ type ZookeeperClient struct {
Wait sync.WaitGroup
valid uint32
reconnectCh chan struct{}
closeCh chan struct{}
eventRegistry map[string][]*chan struct{}
eventRegistryLock sync.RWMutex
}
......@@ -178,7 +177,6 @@ func NewZookeeperClient(name string, zkAddrs []string, timeout time.Duration) (*
ZkAddrs: zkAddrs,
Timeout: timeout,
reconnectCh: make(chan struct{}),
closeCh: make(chan struct{}),
eventRegistry: make(map[string][]*chan struct{}),
}
// connect to zookeeper
......@@ -213,7 +211,6 @@ func NewMockZookeeperClient(name string, timeout time.Duration, opts ...Option)
ZkAddrs: []string{},
Timeout: timeout,
reconnectCh: make(chan struct{}),
closeCh: make(chan struct{}),
eventRegistry: make(map[string][]*chan struct{}),
}
......@@ -603,11 +600,6 @@ func (z *ZookeeperClient) Reconnect() <-chan struct{} {
return z.reconnectCh
}
// CloseConn gets zookeeper client close event
func (z *ZookeeperClient) CloseConn() <-chan struct{} {
return z.closeCh
}
// In my opinion, this method should never called by user, here just for lint
func (z *ZookeeperClient) Close() {
z.Conn.Close()
......
......@@ -48,9 +48,6 @@ func HandleClientRestart(r ZkClientFacade) {
case <-r.Done():
logger.Warnf("receive registry destroy event, quit client restart handler")
return
case <-r.ZkClient().CloseConn():
logger.Warnf("receive zk client close event, quit client restart handler")
return
}
}
}
......@@ -100,6 +100,4 @@ func Test_Facade(t *testing.T) {
go HandleClientRestart(mock)
states := []zk.State{zk.StateConnecting, zk.StateConnected, zk.StateHasSession}
verifyEventStateOrder(t, event, states, "event channel")
verifyEventStateOrder(t, event, []zk.State{zk.StateDisconnected}, "event channel")
//time.Sleep(2e9)
}
0% or .
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment