Skip to content

Commit

Permalink
TestLeaderOnlyCommitsLogFromCurrentTerm
Browse files Browse the repository at this point in the history
Leader only acks to itself on `(*raft).advance` so we have to
make this test a bit more like the real thing.

Signed-off-by: Tobias Grieger <tobias.b.grieger@gmail.com>
  • Loading branch information
tbg committed Sep 20, 2022
1 parent 9ff144e commit 7060d75
Showing 1 changed file with 3 additions and 0 deletions.
3 changes: 3 additions & 0 deletions raft/raft_paper_test.go
Original file line number Diff line number Diff line change
Expand Up @@ -894,6 +894,9 @@ func TestLeaderOnlyCommitsLogFromCurrentTerm(t *testing.T) {
r.Step(pb.Message{From: 1, To: 1, Type: pb.MsgProp, Entries: []pb.Entry{{}}})

r.Step(pb.Message{From: 2, To: 1, Type: pb.MsgAppResp, Term: r.Term, Index: tt.index})
rd := newReady(r, &SoftState{}, pb.HardState{})
storage.Append(rd.Entries)
r.advance(rd)
if r.raftLog.committed != tt.wcommit {
t.Errorf("#%d: commit = %d, want %d", i, r.raftLog.committed, tt.wcommit)
}
Expand Down

0 comments on commit 7060d75

Please sign in to comment.