From f11817dcdf5a04b4587aa226506075159461c633 Mon Sep 17 00:00:00 2001 From: James Phillips Date: Wed, 25 Jan 2017 22:11:30 -0800 Subject: [PATCH] Tweaks leader test now that we have new wait timing. --- consul/leader_test.go | 16 +++++++++++----- 1 file changed, 11 insertions(+), 5 deletions(-) diff --git a/consul/leader_test.go b/consul/leader_test.go index c4312dfbad..329bf41a35 100644 --- a/consul/leader_test.go +++ b/consul/leader_test.go @@ -225,16 +225,22 @@ func TestLeader_ReapMember(t *testing.T) { } s1.reconcileCh <- c1mem - // Should be deregistered - testutil.WaitForResult(func() (bool, error) { + // Should be deregistered; we have to poll quickly here because + // anti-entropy will put it back. + reaped := false + for start := time.Now(); time.Since(start) < 5*time.Second; { _, node, err := state.GetNode(c1.config.NodeName) if err != nil { t.Fatalf("err: %v", err) } - return node == nil, nil - }, func(err error) { + if node == nil { + reaped = true + break + } + } + if !reaped { t.Fatalf("client should not be registered") - }) + } } func TestLeader_Reconcile_ReapMember(t *testing.T) {