Fixes up some new tests for the updated testutil.

This commit is contained in:
James Phillips 2017-03-23 17:55:47 -07:00
parent 73fc8d2a52
commit e7ec41ecbe
No known key found for this signature in database
GPG Key ID: 77183E682AC5FC11

View File

@ -374,7 +374,7 @@ func TestLeader_Reconcile_Races(t *testing.T) {
// Wait for the server to reconcile the client and register it. // Wait for the server to reconcile the client and register it.
state := s1.fsm.State() state := s1.fsm.State()
var nodeAddr string var nodeAddr string
testutil.WaitForResult(func() (bool, error) { if err := testutil.WaitForResult(func() (bool, error) {
_, node, err := state.GetNode(c1.config.NodeName) _, node, err := state.GetNode(c1.config.NodeName)
if err != nil { if err != nil {
t.Fatalf("err: %v", err) t.Fatalf("err: %v", err)
@ -385,9 +385,9 @@ func TestLeader_Reconcile_Races(t *testing.T) {
} else { } else {
return false, nil return false, nil
} }
}, func(err error) { }); err != nil {
t.Fatalf("client should be registered") t.Fatalf("client should be registered: %v", err)
}) }
// Add in some metadata via the catalog (as if the agent synced it // Add in some metadata via the catalog (as if the agent synced it
// there). We also set the serfHealth check to failing so the reconile // there). We also set the serfHealth check to failing so the reconile
@ -428,15 +428,15 @@ func TestLeader_Reconcile_Races(t *testing.T) {
// Fail the member and wait for the health to go critical. // Fail the member and wait for the health to go critical.
c1.Shutdown() c1.Shutdown()
testutil.WaitForResult(func() (bool, error) { if err := testutil.WaitForResult(func() (bool, error) {
_, checks, err := state.NodeChecks(nil, c1.config.NodeName) _, checks, err := state.NodeChecks(nil, c1.config.NodeName)
if err != nil { if err != nil {
t.Fatalf("err: %v", err) t.Fatalf("err: %v", err)
} }
return checks[0].Status == structs.HealthCritical, errors.New(checks[0].Status) return checks[0].Status == structs.HealthCritical, errors.New(checks[0].Status)
}, func(err error) { }); err != nil {
t.Fatalf("check status is %v, should be critical", err) t.Fatalf("check status should be critical: %v", err)
}) }
// Make sure the metadata didn't get clobbered. // Make sure the metadata didn't get clobbered.
_, node, err = state.GetNode(c1.config.NodeName) _, node, err = state.GetNode(c1.config.NodeName)