add serf check to various api/agent tests

This commit is contained in:
Alvin Huang 2019-02-22 13:41:28 -05:00
parent 897c5ff746
commit 23417780dc
1 changed files with 6 additions and 0 deletions

View File

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