Fixed unstable test TestUiNodeInfo (#4586)

This commit is contained in:
Pierre Souchay 2018-08-27 17:49:14 +02:00 committed by Freddy
parent 0c2d9b0782
commit 33184fce85
1 changed files with 5 additions and 0 deletions

View File

@ -12,6 +12,8 @@ import (
"reflect"
"testing"
"github.com/hashicorp/consul/testrpc"
"github.com/hashicorp/consul/agent/structs"
"github.com/hashicorp/consul/api"
"github.com/hashicorp/consul/testutil"
@ -29,6 +31,7 @@ func TestUiIndex(t *testing.T) {
ui_dir = "`+uiDir+`"
`)
defer a.Shutdown()
testrpc.WaitForLeader(t, a.RPC, "dc1")
// Create file
path := filepath.Join(a.Config.UIDir, "my-file")
@ -65,6 +68,7 @@ func TestUiNodes(t *testing.T) {
t.Parallel()
a := NewTestAgent(t.Name(), "")
defer a.Shutdown()
testrpc.WaitForLeader(t, a.RPC, "dc1")
args := &structs.RegisterRequest{
Datacenter: "dc1",
@ -102,6 +106,7 @@ func TestUiNodeInfo(t *testing.T) {
t.Parallel()
a := NewTestAgent(t.Name(), "")
defer a.Shutdown()
testrpc.WaitForLeader(t, a.RPC, "dc1")
req, _ := http.NewRequest("GET", fmt.Sprintf("/v1/internal/ui/node/%s", a.Config.NodeName), nil)
resp := httptest.NewRecorder()