From 896bac1f76e7d30dad99257b1c6b494dbb5c1558 Mon Sep 17 00:00:00 2001 From: Xiang Li Date: Thu, 18 Dec 2014 17:10:37 -0800 Subject: [PATCH] raft: flush the commit to fix a race in test --- raft/raft_test.go | 4 +++- 1 file changed, 3 insertions(+), 1 deletion(-) diff --git a/raft/raft_test.go b/raft/raft_test.go index 472e2c32d..041d5f37a 100644 --- a/raft/raft_test.go +++ b/raft/raft_test.go @@ -451,8 +451,10 @@ func TestCandidateConcede(t *testing.T) { tt.send(pb.Message{From: 3, To: 3, Type: pb.MsgBeat}) data := []byte("force follower") - // send a proposal to 2 to flush out a MsgApp to 0 + // send a proposal to 3 to flush out a MsgApp to 1 tt.send(pb.Message{From: 3, To: 3, Type: pb.MsgProp, Entries: []pb.Entry{{Data: data}}}) + // send heartbeat; flush out commit + tt.send(pb.Message{From: 3, To: 3, Type: pb.MsgBeat}) a := tt.peers[1].(*raft) if g := a.state; g != StateFollower {