From aed9d123fabccadeefb086e7a33aacc559e0cc71 Mon Sep 17 00:00:00 2001 From: Alvin Huang Date: Fri, 22 Feb 2019 13:41:28 -0500 Subject: [PATCH] add serf check to various api/agent tests --- api/agent_test.go | 6 ++++++ 1 file changed, 6 insertions(+) diff --git a/api/agent_test.go b/api/agent_test.go index ce5a65dfd8..17580eaa74 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 {