command: check LastIndex is not zero while waiting for leader

This commit is contained in:
Ryan Uber 2015-01-07 15:17:32 -08:00
parent 1f3c1b97a2
commit d97305e376
2 changed files with 1 additions and 4 deletions

View File

@ -79,10 +79,7 @@ func waitForLeader(t *testing.T, httpAddr string) {
}
testutil.WaitForResult(func() (bool, error) {
_, qm, err := client.Catalog().Nodes(nil)
if err != nil {
return false, err
}
return qm.KnownLeader, nil
return err == nil && qm.KnownLeader && qm.LastIndex > 0, err
}, func(err error) {
t.Fatalf("failed to find leader: %v", err)
})

Binary file not shown.