Skip to content

Commit 3e6cb62

Browse files
authored
Merge pull request #61 from kikimo/fix-raft-test
minor fix for raft test
2 parents e293cfa + c7c26f3 commit 3e6cb62

File tree

1 file changed

+5
-9
lines changed

1 file changed

+5
-9
lines changed

raft_test.go

Lines changed: 5 additions & 9 deletions
Original file line numberDiff line numberDiff line change
@@ -461,13 +461,9 @@ func TestLearnerCanVote(t *testing.T) {
461461
n2.Step(pb.Message{From: 1, To: 2, Term: 2, Type: pb.MsgVote, LogTerm: 11, Index: 11})
462462

463463
msgs := n2.readMessages()
464-
if len(msgs) != 1 {
465-
t.Fatalf("expected exactly one message, not %+v", msgs)
466-
}
467-
msg := msgs[0]
468-
if msg.Type != pb.MsgVoteResp && !msg.Reject {
469-
t.Fatal("expected learner to not reject vote")
470-
}
464+
require.Len(t, msgs, 1)
465+
require.Equal(t, msgs[0].Type, pb.MsgVoteResp)
466+
require.False(t, msgs[0].Reject, "expected learner to not reject vote")
471467
}
472468

473469
func TestLeaderCycle(t *testing.T) {
@@ -835,7 +831,7 @@ func TestCommitWithoutNewTermEntry(t *testing.T) {
835831
tt := newNetwork(nil, nil, nil, nil, nil)
836832
tt.send(pb.Message{From: 1, To: 1, Type: pb.MsgHup})
837833

838-
// 0 cannot reach 2,3,4
834+
// 0 cannot reach 3,4,5
839835
tt.cut(1, 3)
840836
tt.cut(1, 4)
841837
tt.cut(1, 5)
@@ -1725,7 +1721,7 @@ func TestAllServerStepdown(t *testing.T) {
17251721
wlead = None
17261722
}
17271723
if sm.lead != wlead {
1728-
t.Errorf("#%d, sm.lead = %d, want %d", i, sm.lead, None)
1724+
t.Errorf("#%d, sm.lead = %d, want %d", i, sm.lead, wlead)
17291725
}
17301726
}
17311727
}

0 commit comments

Comments
 (0)