chore(tests): start TLS cluster slowly to evade problem

This commit is contained in:
Yicheng Qin 2014-04-04 10:02:13 -07:00
parent bec7d7f614
commit 0a4b6570e1
2 changed files with 19 additions and 2 deletions

View File

@ -2,6 +2,7 @@ package test
import ( import (
"os" "os"
"strconv"
"testing" "testing"
"time" "time"
@ -128,6 +129,12 @@ func TestTLSMultiNodeKillAllAndRecovery(t *testing.T) {
for i := 0; i < clusterSize; i++ { for i := 0; i < clusterSize; i++ {
etcds[i], err = os.StartProcess(EtcdBinPath, argGroup[i], procAttr) etcds[i], err = os.StartProcess(EtcdBinPath, argGroup[i], procAttr)
// See util.go for the reason to wait for server
client := buildClient()
err = WaitForServer("127.0.0.1:400"+strconv.Itoa(i+1), client, "http")
if err != nil {
t.Fatalf("node start error: %s", err)
}
} }
go Monitor(clusterSize, 1, leaderChan, all, stop) go Monitor(clusterSize, 1, leaderChan, all, stop)

View File

@ -129,9 +129,19 @@ func CreateCluster(size int, procAttr *os.ProcAttr, ssl bool) ([][]string, []*os
// The problem is that if the master isn't up then the children // The problem is that if the master isn't up then the children
// have to retry. This retry can take upwards of 15 seconds // have to retry. This retry can take upwards of 15 seconds
// which slows tests way down and some of them fail. // which slows tests way down and some of them fail.
if i == 0 { //
// Waiting for each server to start when ssl is a workaround.
// Autotest machines are dramatically slow, and it could spend
// several seconds to build TSL connections between servers. That
// is extremely terribe when the second machine joins the cluster
// because the cluster is out of work at this time. The guy
// tries to join during this time will fail, and current implementation
// makes it fail after just one-time try(bug in #661). This
// makes the cluster start with N-1 machines.
// TODO(yichengq): It should be fixed.
if i == 0 || ssl {
client := buildClient() client := buildClient()
err = WaitForServer("127.0.0.1:4001", client, "http") err = WaitForServer("127.0.0.1:400"+strconv.Itoa(i+1), client, "http")
if err != nil { if err != nil {
return nil, nil, err return nil, nil, err
} }