From bfbc5393212be897a166fcd7a8776377fe5a238e Mon Sep 17 00:00:00 2001 From: Brandon Philips Date: Thu, 6 Feb 2014 20:18:09 -0800 Subject: [PATCH] hack(tests/discovery): don't use go-etcd for watch go-etcd has a bug in the watcher that holds open a goroutine. Avoid goetcd for this operation until it is fixed. --- tests/functional/discovery_test.go | 15 +++++---------- 1 file changed, 5 insertions(+), 10 deletions(-) diff --git a/tests/functional/discovery_test.go b/tests/functional/discovery_test.go index 2998f2466..f4118985f 100644 --- a/tests/functional/discovery_test.go +++ b/tests/functional/discovery_test.go @@ -177,17 +177,12 @@ func TestDiscoverySecondPeerUp(t *testing.T) { } wc := goetcd.NewClient([]string{s.URL()}) - _, err = wc.Set("test", "0", 0) + testResp, err := wc.Set("test", "0", 0) if err != nil { t.Fatalf("Couldn't set a test key on the leader %v", err) } - receiver := make(chan *goetcd.Response) - stop := make(chan bool) - - go wc.Watch("_etcd/registry/3/node1", 0, false, receiver, stop) - v = url.Values{} v.Set("value", u) resp, err = etcdtest.PutForm(fmt.Sprintf("%s%s", s.URL(), "/v2/keys/_etcd/registry/3/ETCDTEST"), v) @@ -199,10 +194,10 @@ func TestDiscoverySecondPeerUp(t *testing.T) { } defer stopServer(proc) - // Test to ensure the machine registered iteslf - watchResp := <-receiver - if watchResp.Node.Value != "http://127.0.0.1:7001" { - t.Fatalf("Second peer didn't register! %s", watchResp.Node.Value) + watch := fmt.Sprintf("%s%s%d", s.URL(), "/v2/keys/_etcd/registry/3/node1?wait=true&waitIndex=", testResp.EtcdIndex) + resp, err = http.Get(watch) + if err != nil { + t.Fatal(err.Error()) } // TODO(bp): need to have a better way of knowing a machine is up