Remove all sleeps from `ui_endpoint_test.go`

This commit is contained in:
William Tisäter 2014-05-09 02:08:01 +02:00
parent 69eef2b455
commit 2d36b0f017
1 changed files with 3 additions and 5 deletions

View File

@ -3,6 +3,7 @@ package agent
import ( import (
"bytes" "bytes"
"fmt" "fmt"
"github.com/hashicorp/consul/testutil"
"github.com/hashicorp/consul/consul/structs" "github.com/hashicorp/consul/consul/structs"
"io" "io"
"io/ioutil" "io/ioutil"
@ -12,7 +13,6 @@ import (
"path/filepath" "path/filepath"
"reflect" "reflect"
"testing" "testing"
"time"
) )
func TestUiIndex(t *testing.T) { func TestUiIndex(t *testing.T) {
@ -60,8 +60,7 @@ func TestUiNodes(t *testing.T) {
defer srv.Shutdown() defer srv.Shutdown()
defer srv.agent.Shutdown() defer srv.agent.Shutdown()
// Wait for leader testutil.WaitForLeader(t, srv.agent.RPC, "dc1")
time.Sleep(100 * time.Millisecond)
req, err := http.NewRequest("GET", "/v1/internal/ui/nodes/dc1", nil) req, err := http.NewRequest("GET", "/v1/internal/ui/nodes/dc1", nil)
if err != nil { if err != nil {
@ -88,8 +87,7 @@ func TestUiNodeInfo(t *testing.T) {
defer srv.Shutdown() defer srv.Shutdown()
defer srv.agent.Shutdown() defer srv.agent.Shutdown()
// Wait for leader testutil.WaitForLeader(t, srv.agent.RPC, "dc1")
time.Sleep(100 * time.Millisecond)
req, err := http.NewRequest("GET", req, err := http.NewRequest("GET",
fmt.Sprintf("/v1/internal/ui/node/%s", srv.agent.config.NodeName), nil) fmt.Sprintf("/v1/internal/ui/node/%s", srv.agent.config.NodeName), nil)