From 7ef99e36176fde2fc5126e02e5cfa91d929d4f5a Mon Sep 17 00:00:00 2001 From: niebayes Date: Tue, 30 Aug 2022 16:56:01 +0800 Subject: [PATCH] replace direct accesses on raftLog.entries with allEntries interface (#421) #418 Co-authored-by: Connor --- raft/raft_test.go | 6 +++--- 1 file changed, 3 insertions(+), 3 deletions(-) diff --git a/raft/raft_test.go b/raft/raft_test.go index efe9c60f..0ba8aac7 100644 --- a/raft/raft_test.go +++ b/raft/raft_test.go @@ -175,7 +175,7 @@ func TestLeaderElectionOverwriteNewerLogs2AB(t *testing.T) { // term 3 at index 2). for i := range n.peers { sm := n.peers[i].(*Raft) - entries := sm.RaftLog.entries + entries := sm.RaftLog.allEntries() if len(entries) != 2 { t.Fatalf("node %d: len(entries) == %d, want 2", i, len(entries)) } @@ -733,8 +733,8 @@ func TestAllServerStepdown2AB(t *testing.T) { if sm.RaftLog.LastIndex() != tt.windex { t.Errorf("#%d.%d index = %v , want %v", i, j, sm.RaftLog.LastIndex(), tt.windex) } - if uint64(len(sm.RaftLog.entries)) != tt.windex { - t.Errorf("#%d.%d len(ents) = %v , want %v", i, j, len(sm.RaftLog.entries), tt.windex) + if uint64(len(sm.RaftLog.allEntries())) != tt.windex { + t.Errorf("#%d.%d len(ents) = %v , want %v", i, j, len(sm.RaftLog.allEntries()), tt.windex) } wlead := uint64(2) if msgType == pb.MessageType_MsgRequestVote {