tests: wait until leadership loop finishes

Reverts d5c7d6e491 .

We actually need to forward the request to ensure that the leader is
properly configured and that establishedLeadership completes.
This commit is contained in:
Mahmood Ali
2020-03-06 14:39:39 -05:00
parent 3d342e2379
commit 96a0938b0e

View File

@@ -83,9 +83,9 @@ type rpcFn func(string, interface{}, interface{}) error
// WaitForLeader blocks until a leader is elected.
func WaitForLeader(t testing.T, rpc rpcFn) {
t.Helper()
WaitForResult(func() (bool, error) {
args := &structs.GenericRequest{}
args.AllowStale = true
var leader string
err := rpc("Status.Leader", args, &leader)
return leader != "", err