Explorar o código

raft: use raft helper function in testing

Yicheng Qin %!s(int64=11) %!d(string=hai) anos
pai
achega
dc1357afa9
Modificáronse 1 ficheiros con 3 adicións e 3 borrados
  1. 3 3
      raft/raft_test.go

+ 3 - 3
raft/raft_test.go

@@ -11,7 +11,7 @@ import (
 )
 
 // nextEnts returns the appliable entries and updates the applied index
-func (r *raft) nextEnts() (ents []pb.Entry) {
+func nextEnts(r *raft) (ents []pb.Entry) {
 	ents = r.raftLog.nextEnts()
 	r.raftLog.resetNextEnts()
 	return ents
@@ -91,7 +91,7 @@ func TestLogReplication(t *testing.T) {
 			}
 
 			ents := make([]pb.Entry, 0)
-			for _, e := range sm.nextEnts() {
+			for _, e := range nextEnts(sm) {
 				if e.Data != nil {
 					ents = append(ents, e)
 				}
@@ -867,7 +867,7 @@ func TestSlowNodeRestore(t *testing.T) {
 		nt.send(pb.Message{From: 1, To: 1, Type: msgProp, Entries: []pb.Entry{{}}})
 	}
 	lead := nt.peers[1].(*raft)
-	lead.nextEnts()
+	nextEnts(lead)
 	lead.compact(nil)
 
 	nt.recover()