mirror of https://github.com/status-im/consul.git
command: check LastIndex is not zero while waiting for leader
This commit is contained in:
parent
1f3c1b97a2
commit
d97305e376
|
@ -79,10 +79,7 @@ func waitForLeader(t *testing.T, httpAddr string) {
|
||||||
}
|
}
|
||||||
testutil.WaitForResult(func() (bool, error) {
|
testutil.WaitForResult(func() (bool, error) {
|
||||||
_, qm, err := client.Catalog().Nodes(nil)
|
_, qm, err := client.Catalog().Nodes(nil)
|
||||||
if err != nil {
|
return err == nil && qm.KnownLeader && qm.LastIndex > 0, err
|
||||||
return false, err
|
|
||||||
}
|
|
||||||
return qm.KnownLeader, nil
|
|
||||||
}, func(err error) {
|
}, func(err error) {
|
||||||
t.Fatalf("failed to find leader: %v", err)
|
t.Fatalf("failed to find leader: %v", err)
|
||||||
})
|
})
|
||||||
|
|
Binary file not shown.
Loading…
Reference in New Issue