From 2d36b0f0177746e4b16001b07e7e77b09ca66b6c Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?William=20Tisa=CC=88ter?= Date: Fri, 9 May 2014 02:08:01 +0200 Subject: [PATCH] Remove all sleeps from `ui_endpoint_test.go` --- command/agent/ui_endpoint_test.go | 8 +++----- 1 file changed, 3 insertions(+), 5 deletions(-) diff --git a/command/agent/ui_endpoint_test.go b/command/agent/ui_endpoint_test.go index c056e433ee..ab734f3cb4 100644 --- a/command/agent/ui_endpoint_test.go +++ b/command/agent/ui_endpoint_test.go @@ -3,6 +3,7 @@ package agent import ( "bytes" "fmt" + "github.com/hashicorp/consul/testutil" "github.com/hashicorp/consul/consul/structs" "io" "io/ioutil" @@ -12,7 +13,6 @@ import ( "path/filepath" "reflect" "testing" - "time" ) func TestUiIndex(t *testing.T) { @@ -60,8 +60,7 @@ func TestUiNodes(t *testing.T) { defer srv.Shutdown() defer srv.agent.Shutdown() - // Wait for leader - time.Sleep(100 * time.Millisecond) + testutil.WaitForLeader(t, srv.agent.RPC, "dc1") req, err := http.NewRequest("GET", "/v1/internal/ui/nodes/dc1", nil) if err != nil { @@ -88,8 +87,7 @@ func TestUiNodeInfo(t *testing.T) { defer srv.Shutdown() defer srv.agent.Shutdown() - // Wait for leader - time.Sleep(100 * time.Millisecond) + testutil.WaitForLeader(t, srv.agent.RPC, "dc1") req, err := http.NewRequest("GET", fmt.Sprintf("/v1/internal/ui/node/%s", srv.agent.config.NodeName), nil)