mirror of https://github.com/status-im/consul.git
test: unflake two TestHealthServiceNode_* tests
Replaces WaitForLeader with WaitForTestAgent. This waits to make sure that the node itself is correctly registered in the catalog before attempting additional registrations.
This commit is contained in:
parent
b437b53d55
commit
7d4d416a4d
|
@ -740,7 +740,7 @@ func TestHealthServiceNodes_Filter(t *testing.T) {
|
||||||
t.Parallel()
|
t.Parallel()
|
||||||
a := NewTestAgent(t, t.Name(), "")
|
a := NewTestAgent(t, t.Name(), "")
|
||||||
defer a.Shutdown()
|
defer a.Shutdown()
|
||||||
testrpc.WaitForLeader(t, a.RPC, "dc1")
|
testrpc.WaitForTestAgent(t, a.RPC, "dc1")
|
||||||
|
|
||||||
req, _ := http.NewRequest("GET", "/v1/health/service/consul?dc=dc1&filter="+url.QueryEscape("Node.Node == `test-health-node`"), nil)
|
req, _ := http.NewRequest("GET", "/v1/health/service/consul?dc=dc1&filter="+url.QueryEscape("Node.Node == `test-health-node`"), nil)
|
||||||
resp := httptest.NewRecorder()
|
resp := httptest.NewRecorder()
|
||||||
|
@ -792,7 +792,7 @@ func TestHealthServiceNodes_Filter(t *testing.T) {
|
||||||
|
|
||||||
assertIndex(t, resp)
|
assertIndex(t, resp)
|
||||||
|
|
||||||
// Should be a non-nil empty list for checks
|
// Should be a list of checks with 1 element
|
||||||
nodes = obj.(structs.CheckServiceNodes)
|
nodes = obj.(structs.CheckServiceNodes)
|
||||||
require.Len(t, nodes, 1)
|
require.Len(t, nodes, 1)
|
||||||
require.Len(t, nodes[0].Checks, 1)
|
require.Len(t, nodes[0].Checks, 1)
|
||||||
|
@ -978,7 +978,7 @@ func TestHealthServiceNodes_CheckType(t *testing.T) {
|
||||||
t.Parallel()
|
t.Parallel()
|
||||||
a := NewTestAgent(t, t.Name(), "")
|
a := NewTestAgent(t, t.Name(), "")
|
||||||
defer a.Shutdown()
|
defer a.Shutdown()
|
||||||
testrpc.WaitForLeader(t, a.RPC, "dc1")
|
testrpc.WaitForTestAgent(t, a.RPC, "dc1")
|
||||||
|
|
||||||
req, _ := http.NewRequest("GET", "/v1/health/service/consul?dc=dc1", nil)
|
req, _ := http.NewRequest("GET", "/v1/health/service/consul?dc=dc1", nil)
|
||||||
resp := httptest.NewRecorder()
|
resp := httptest.NewRecorder()
|
||||||
|
|
Loading…
Reference in New Issue