Skip to content

Commit

Permalink
Merge pull request #61 from kikimo/fix-raft-test
Browse files Browse the repository at this point in the history
minor fix for raft test
  • Loading branch information
ahrtr authored Jun 2, 2023
2 parents e293cfa + c7c26f3 commit 3e6cb62
Showing 1 changed file with 5 additions and 9 deletions.
14 changes: 5 additions & 9 deletions raft_test.go
Original file line number Diff line number Diff line change
Expand Up @@ -461,13 +461,9 @@ func TestLearnerCanVote(t *testing.T) {
n2.Step(pb.Message{From: 1, To: 2, Term: 2, Type: pb.MsgVote, LogTerm: 11, Index: 11})

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

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

// 0 cannot reach 2,3,4
// 0 cannot reach 3,4,5
tt.cut(1, 3)
tt.cut(1, 4)
tt.cut(1, 5)
Expand Down Expand Up @@ -1725,7 +1721,7 @@ func TestAllServerStepdown(t *testing.T) {
wlead = None
}
if sm.lead != wlead {
t.Errorf("#%d, sm.lead = %d, want %d", i, sm.lead, None)
t.Errorf("#%d, sm.lead = %d, want %d", i, sm.lead, wlead)
}
}
}
Expand Down

0 comments on commit 3e6cb62

Please sign in to comment.