agent: wrap deferred anti-entropy sync test in WaitForResult

This commit is contained in:
Ryan Uber 2015-01-09 16:42:44 -08:00
parent ab7896256f
commit 12cd27e588
1 changed files with 14 additions and 11 deletions

View File

@ -431,20 +431,23 @@ func TestAgentAntiEntropy_Check_DeferSync(t *testing.T) {
} }
// Wait for a deferred update // Wait for a deferred update
time.Sleep(100 * time.Millisecond) testutil.WaitForResult(func() (bool, error) {
if err := agent.RPC("Health.NodeChecks", &req, &checks); err != nil { if err := agent.RPC("Health.NodeChecks", &req, &checks); err != nil {
t.Fatalf("err: %v", err) return false, err
} }
// Verify not updated // Verify updated
for _, chk := range checks.HealthChecks { for _, chk := range checks.HealthChecks {
switch chk.CheckID { switch chk.CheckID {
case "web": case "web":
if chk.Output != "output" { if chk.Output != "output" {
t.Fatalf("no update: %v", chk) return false, fmt.Errorf("no update: %v", chk)
}
} }
} }
} }, func(err error) {
t.Fatalf("err: %s", err)
})
} }
var testRegisterRules = ` var testRegisterRules = `