From 9f012d8ba53e4527beee81deb95eac89b245e098 Mon Sep 17 00:00:00 2001 From: Dhia Ayachi Date: Wed, 22 Sep 2021 11:36:27 -0400 Subject: [PATCH] add wait loop to test --- raft_test.go | 5 +++++ 1 file changed, 5 insertions(+) diff --git a/raft_test.go b/raft_test.go index 1e7a2452d..1fee1adb7 100644 --- a/raft_test.go +++ b/raft_test.go @@ -760,6 +760,11 @@ func TestRaft_RemovedFollower_Vote(t *testing.T) { time.Sleep(c.propagateTimeout) // wait for the remaining follower to trigger an election + count := 0 + for follower.getState() != Candidate && count < 1000 { + count++ + time.Sleep(1 * time.Millisecond) + } require.Equal(t, Candidate, follower.getState()) // send a vote request from the removed follower to the Candidate follower