diff --git a/api/agent_test.go b/api/agent_test.go index ce5a65dfd..17580eaa7 100644 --- a/api/agent_test.go +++ b/api/agent_test.go @@ -39,6 +39,8 @@ func TestAPI_AgentMetrics(t *testing.T) { defer s.Stop() agent := c.Agent() + s.WaitForSerfCheck(t) + timer := &retry.Timer{Timeout: 10 * time.Second, Wait: 500 * time.Millisecond} retry.RunWith(timer, t, func(r *retry.R) { metrics, err := agent.Metrics() @@ -168,6 +170,7 @@ func TestAPI_AgentServices(t *testing.T) { defer s.Stop() agent := c.Agent() + s.WaitForSerfCheck(t) reg := &AgentServiceRegistration{ Name: "foo", @@ -743,6 +746,7 @@ func TestAPI_AgentSetTTLStatus(t *testing.T) { defer s.Stop() agent := c.Agent() + s.WaitForSerfCheck(t) reg := &AgentServiceRegistration{ Name: "foo", @@ -957,6 +961,7 @@ func TestAPI_AgentChecks_serviceBound(t *testing.T) { defer s.Stop() agent := c.Agent() + s.WaitForSerfCheck(t) // First register a service serviceReg := &AgentServiceRegistration{ @@ -1198,6 +1203,7 @@ func TestAPI_NodeMaintenance(t *testing.T) { defer s.Stop() agent := c.Agent() + s.WaitForSerfCheck(t) // Enable maintenance mode if err := agent.EnableNodeMaintenance("broken"); err != nil {