From 9b6b75f77cdb7dd6df5f28fcc9b280cebc7ee12f Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?William=20Tisa=CC=88ter?= Date: Fri, 9 May 2014 02:14:39 +0200 Subject: [PATCH] Fix race condition in `TestLeader_FailedMember` --- 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 955c00e22..39935c2ae 100644 --- a/consul/leader_test.go +++ b/consul/leader_test.go @@ -88,10 +88,12 @@ func TestLeader_FailedMember(t *testing.T) { // Should be registered state := s1.fsm.State() - _, found, _ := state.GetNode(c1.config.NodeName) - if !found { + testutil.WaitForResult(func() (bool, error) { + _, found, _ := state.GetNode(c1.config.NodeName) + return found == true, nil + }, func(err error) { t.Fatalf("client not registered") - } + }) // Should have a check _, checks := state.NodeChecks(c1.config.NodeName)