From f37f5fde54efb61e8c42b2746c101e435ed2ad8a Mon Sep 17 00:00:00 2001 From: Armon Dadgar Date: Fri, 17 Oct 2014 17:40:03 -0700 Subject: [PATCH] consul: Improving test reliability --- consul/leader_test.go | 8 +++++--- 1 file changed, 5 insertions(+), 3 deletions(-) diff --git a/consul/leader_test.go b/consul/leader_test.go index 6cad9cd70e..75535d56bb 100644 --- a/consul/leader_test.go +++ b/consul/leader_test.go @@ -390,10 +390,12 @@ func TestLeader_LeftLeader(t *testing.T) { // Verify the old leader is deregistered state := remain.fsm.State() - _, found, _ := state.GetNode(leader.config.NodeName) - if found { + testutil.WaitForResult(func() (bool, error) { + _, found, _ := state.GetNode(leader.config.NodeName) + return !found, nil + }, func(err error) { t.Fatalf("leader should be deregistered") - } + }) } func TestLeader_MultiBootstrap(t *testing.T) {