mirror of
https://github.com/etcd-io/etcd.git
synced 2024-09-27 06:25:44 +00:00
cleanup print
This commit is contained in:
parent
c3533d6ac2
commit
fb00d335c0
@ -63,7 +63,7 @@ func TestKillLeader(t *testing.T) {
|
||||
fmt.Println("Leader election time average is", avgTime, "with election timeout", ElectionTimeout)
|
||||
etcds[num], err = os.StartProcess("etcd", argGroup[num], procAttr)
|
||||
}
|
||||
stop<-true
|
||||
stop <- true
|
||||
}
|
||||
|
||||
// TestKillRandom kills random machines in the cluster and
|
||||
@ -87,7 +87,6 @@ func TestKillRandom(t *testing.T) {
|
||||
|
||||
time.Sleep(3 * time.Second)
|
||||
|
||||
|
||||
go monitor(clusterSize, 4, leaderChan, all, stop)
|
||||
|
||||
toKill := make(map[int]bool)
|
||||
@ -127,7 +126,7 @@ func TestKillRandom(t *testing.T) {
|
||||
<-all
|
||||
}
|
||||
|
||||
stop<-true
|
||||
stop <- true
|
||||
}
|
||||
|
||||
func templateBenchmarkEtcdDirectCall(b *testing.B, tls bool) {
|
||||
|
@ -16,7 +16,7 @@ func getMachines() []string {
|
||||
|
||||
leader, _ := nameToEtcdURL(raftServer.Leader())
|
||||
|
||||
i := 0
|
||||
i := 0
|
||||
|
||||
if leader != "" {
|
||||
|
||||
@ -30,7 +30,7 @@ func getMachines() []string {
|
||||
machines[i] = leader
|
||||
i++
|
||||
machines[i] = info.EtcdURL
|
||||
i++
|
||||
i++
|
||||
}
|
||||
}
|
||||
|
||||
|
9
test.go
9
test.go
@ -50,7 +50,6 @@ func set(stop chan bool) {
|
||||
|
||||
i++
|
||||
}
|
||||
fmt.Println("set stop")
|
||||
stop <- true
|
||||
}
|
||||
|
||||
@ -106,9 +105,8 @@ func createCluster(size int, procAttr *os.ProcAttr, ssl bool) ([][]string, []*os
|
||||
|
||||
// Destroy all the nodes in the cluster
|
||||
func destroyCluster(etcds []*os.Process) error {
|
||||
for i, etcd := range etcds {
|
||||
for _, etcd := range etcds {
|
||||
err := etcd.Kill()
|
||||
fmt.Println("kill ", i)
|
||||
if err != nil {
|
||||
panic(err.Error())
|
||||
}
|
||||
@ -131,7 +129,6 @@ func monitor(size int, allowDeadNum int, leaderChan chan string, all chan bool,
|
||||
leader, err := getLeader(fmt.Sprintf(baseAddrFormat, i+1))
|
||||
|
||||
if err == nil {
|
||||
//fmt.Printf("leader:[%d]->%s\n", i, leader)
|
||||
leaderMap[i] = leader
|
||||
|
||||
if knownLeader == "unknown" {
|
||||
@ -144,7 +141,6 @@ func monitor(size int, allowDeadNum int, leaderChan chan string, all chan bool,
|
||||
}
|
||||
|
||||
} else {
|
||||
//fmt.Printf("dead: [%d]\n", i)
|
||||
dead++
|
||||
if dead > allowDeadNum {
|
||||
break
|
||||
@ -154,9 +150,8 @@ func monitor(size int, allowDeadNum int, leaderChan chan string, all chan bool,
|
||||
}
|
||||
|
||||
if i == size {
|
||||
//fmt.Println("leader found")
|
||||
select {
|
||||
case <- stop:
|
||||
case <-stop:
|
||||
return
|
||||
case <-leaderChan:
|
||||
leaderChan <- knownLeader
|
||||
|
Loading…
x
Reference in New Issue
Block a user