raft: remove unnecessary type conversion

Signed-off-by: Gyuho Lee <gyuhox@gmail.com>
This commit is contained in:
Gyuho Lee 2018-07-05 10:12:45 -07:00
parent b01d560be0
commit 0249c39cb3
2 changed files with 4 additions and 4 deletions

View File

@ -282,11 +282,11 @@ func TestCompactionSideEffects(t *testing.T) {
lastTerm := lastIndex
storage := NewMemoryStorage()
for i = 1; i <= unstableIndex; i++ {
storage.Append([]pb.Entry{{Term: uint64(i), Index: uint64(i)}})
storage.Append([]pb.Entry{{Term: i, Index: i}})
}
raftLog := newLog(storage, raftLogger)
for i = unstableIndex; i < lastIndex; i++ {
raftLog.append(pb.Entry{Term: uint64(i + 1), Index: uint64(i + 1)})
raftLog.append(pb.Entry{Term: i + 1, Index: i + 1})
}
ok := raftLog.maybeCommit(lastIndex, lastTerm)

View File

@ -303,7 +303,7 @@ func TestLeaderElectionPreVote(t *testing.T) {
func testLeaderElection(t *testing.T, preVote bool) {
var cfg func(*Config)
candState := StateType(StateCandidate)
candState := StateCandidate
candTerm := uint64(1)
if preVote {
cfg = preVoteConfig
@ -1675,7 +1675,7 @@ func TestAllServerStepdown(t *testing.T) {
if sm.Term != tt.wterm {
t.Errorf("#%d.%d term = %v , want %v", i, j, sm.Term, tt.wterm)
}
if uint64(sm.raftLog.lastIndex()) != tt.windex {
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.allEntries())) != tt.windex {