Merge pull request #1042 from unihorn/118

raft: set none to be 0
This commit is contained in:
Xiang Li
2014-09-14 22:32:37 -07:00
5 changed files with 116 additions and 113 deletions

View File

@@ -87,12 +87,12 @@ func TestNode(t *testing.T) {
wants := []Ready{
{
State: raftpb.State{Term: 1, Vote: -1, Commit: 1, LastIndex: 1},
State: raftpb.State{Term: 1, Commit: 1, LastIndex: 1},
Entries: []raftpb.Entry{{Term: 1, Index: 1}},
CommittedEntries: []raftpb.Entry{{Term: 1, Index: 1}},
},
{
State: raftpb.State{Term: 1, Vote: -1, Commit: 2, LastIndex: 2},
State: raftpb.State{Term: 1, Commit: 2, LastIndex: 2},
Entries: []raftpb.Entry{{Term: 1, Index: 2, Data: []byte("foo")}},
CommittedEntries: []raftpb.Entry{{Term: 1, Index: 2, Data: []byte("foo")}},
},
@@ -121,7 +121,7 @@ func TestNodeRestart(t *testing.T) {
{Term: 1, Index: 1},
{Term: 1, Index: 2, Data: []byte("foo")},
}
st := raftpb.State{Term: 1, Vote: -1, Commit: 1, LastIndex: 2}
st := raftpb.State{Term: 1, Commit: 1, LastIndex: 2}
want := Ready{
State: emptyState,