Skip to content

Commit

Permalink
agent: wrap deferred anti-entropy sync test in WaitForResult
Browse files Browse the repository at this point in the history
  • Loading branch information
ryanuber committed Jan 10, 2015
1 parent fab3040 commit c218844
Showing 1 changed file with 14 additions and 11 deletions.
25 changes: 14 additions & 11 deletions command/agent/local_test.go
Original file line number Diff line number Diff line change
Expand Up @@ -431,20 +431,23 @@ func TestAgentAntiEntropy_Check_DeferSync(t *testing.T) {
}

// Wait for a deferred update
time.Sleep(100 * time.Millisecond)
if err := agent.RPC("Health.NodeChecks", &req, &checks); err != nil {
t.Fatalf("err: %v", err)
}
testutil.WaitForResult(func() (bool, error) {
if err := agent.RPC("Health.NodeChecks", &req, &checks); err != nil {
return false, err
}

// Verify not updated
for _, chk := range checks.HealthChecks {
switch chk.CheckID {
case "web":
if chk.Output != "output" {
t.Fatalf("no update: %v", chk)
// Verify updated
for _, chk := range checks.HealthChecks {
switch chk.CheckID {
case "web":
if chk.Output != "output" {
return false, fmt.Errorf("no update: %v", chk)
}
}
}
}
}, func(err error) {
t.Fatalf("err: %s", err)
})
}

var testRegisterRules = `
Expand Down

0 comments on commit c218844

Please sign in to comment.