fix(tests/multi_node_kill_all_and_recovery): wait for cluter to build over

This commit is contained in:
Yicheng Qin 2014-02-25 10:51:43 -08:00
parent df49265674
commit e99bc99dcc

View File

@ -14,6 +14,10 @@ func TestMultiNodeKillAllAndRecovery(t *testing.T) {
procAttr := new(os.ProcAttr)
procAttr.Files = []*os.File{nil, os.Stdout, os.Stderr}
stop := make(chan bool)
leaderChan := make(chan string, 1)
all := make(chan bool, 1)
clusterSize := 5
argGroup, etcds, err := CreateCluster(clusterSize, procAttr, false)
defer DestroyCluster(etcds)
@ -24,9 +28,12 @@ func TestMultiNodeKillAllAndRecovery(t *testing.T) {
c := etcd.NewClient(nil)
c.SyncCluster()
go Monitor(clusterSize, clusterSize, leaderChan, all, stop)
<-all
<-leaderChan
stop <-true
time.Sleep(time.Second)
c.SyncCluster()
// send 10 commands
for i := 0; i < 10; i++ {
@ -44,9 +51,9 @@ func TestMultiNodeKillAllAndRecovery(t *testing.T) {
time.Sleep(time.Second)
stop := make(chan bool)
leaderChan := make(chan string, 1)
all := make(chan bool, 1)
stop = make(chan bool)
leaderChan = make(chan string, 1)
all = make(chan bool, 1)
time.Sleep(time.Second)