From 5bd24d8271f498b59b8f0411c635f569d2bb3a9b Mon Sep 17 00:00:00 2001 From: Xiang Li Date: Thu, 15 Aug 2013 10:23:23 -0700 Subject: [PATCH] wait for exit and release resource --- etcd_test.go | 9 ++++++--- test/test.go | 2 +- 2 files changed, 7 insertions(+), 4 deletions(-) diff --git a/etcd_test.go b/etcd_test.go index c2cbfcf93..cb43a2a4f 100644 --- a/etcd_test.go +++ b/etcd_test.go @@ -292,7 +292,7 @@ func TestKillRandom(t *testing.T) { toKill := make(map[int]bool) for i := 0; i < 20; i++ { - fmt.Printf("TestKillRandom Round[%d/200]\n", i) + fmt.Printf("TestKillRandom Round[%d/20]\n", i) j := 0 for { @@ -310,8 +310,11 @@ func TestKillRandom(t *testing.T) { } for num, _ := range toKill { - etcds[num].Kill() - etcds[num].Release() + err := etcds[num].Kill() + if err != nil { + panic(err) + } + etcds[num].Wait() } time.Sleep(ElectionTimeout) diff --git a/test/test.go b/test/test.go index afa1eeca0..fc96509f3 100644 --- a/test/test.go +++ b/test/test.go @@ -96,7 +96,7 @@ func CreateCluster(size int, procAttr *os.ProcAttr, ssl bool) ([][]string, []*os // have to retry. This retry can take upwards of 15 seconds // which slows tests way down and some of them fail. if i == 0 { - time.Sleep(time.Second) + time.Sleep(time.Second * 2) } }