Browse Source

Fixed unstable test TestUiNodeInfo (#4586)

pull/4593/head
Pierre Souchay 6 years ago committed by Freddy
parent
commit
aea31d3c5d
  1. 5
      agent/ui_endpoint_test.go

5
agent/ui_endpoint_test.go

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

Loading…
Cancel
Save