From 0a4b6570e13cf2d3f4b1b24dc2b3041c8f0d1605 Mon Sep 17 00:00:00 2001 From: Yicheng Qin Date: Fri, 4 Apr 2014 10:02:13 -0700 Subject: [PATCH 1/2] chore(tests): start TLS cluster slowly to evade problem --- .../multi_node_kill_all_and_recovery_test.go | 7 +++++++ tests/functional/util.go | 14 ++++++++++++-- 2 files changed, 19 insertions(+), 2 deletions(-) diff --git a/tests/functional/multi_node_kill_all_and_recovery_test.go b/tests/functional/multi_node_kill_all_and_recovery_test.go index d13936e94..a05e2b35d 100644 --- a/tests/functional/multi_node_kill_all_and_recovery_test.go +++ b/tests/functional/multi_node_kill_all_and_recovery_test.go @@ -2,6 +2,7 @@ package test import ( "os" + "strconv" "testing" "time" @@ -128,6 +129,12 @@ func TestTLSMultiNodeKillAllAndRecovery(t *testing.T) { for i := 0; i < clusterSize; i++ { 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) diff --git a/tests/functional/util.go b/tests/functional/util.go index 646dc9307..57eaadcce 100644 --- a/tests/functional/util.go +++ b/tests/functional/util.go @@ -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 // have to retry. This retry can take upwards of 15 seconds // 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() - 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 { return nil, nil, err } From e624d4ef332fe38a13e614c625b856c809a19eb0 Mon Sep 17 00:00:00 2001 From: Yicheng Qin Date: Fri, 4 Apr 2014 11:19:04 -0700 Subject: [PATCH 2/2] fix(build): make build run well 1. remove unnecessary target directory 2. comparison update to run on linux --- build | 4 ++-- 1 file changed, 2 insertions(+), 2 deletions(-) diff --git a/build b/build index 27a1afa66..a56254995 100755 --- a/build +++ b/build @@ -7,10 +7,10 @@ fi export GOBIN=${PWD}/bin export GOPATH=${PWD} -export GOFMTPATH="./bench ./config ./discovery ./etcd ./error ./http ./log ./machines main.go ./metrics ./mod ./server ./store ./tests" +export GOFMTPATH="./bench ./config ./discovery ./etcd ./error ./http ./log main.go ./metrics ./mod ./server ./store ./tests" # Don't surprise user by formatting their codes by stealth -if [ "$1" == "--fmt" ]; then +if [ "--fmt" = "$1" ]; then gofmt -s -w -l $GOFMTPATH fi