raft: test logs converge

This commit is contained in:
Blake Mizerany 2014-05-18 18:05:03 -07:00 committed by Yicheng Qin
parent 935320289e
commit f6f4329899

View File

@ -25,11 +25,23 @@ func TestLeaderElection(t *testing.T) {
nil,
&stateMachine{log: []Entry{{}, {Term: 1}}},
&stateMachine{log: []Entry{{}, {Term: 2}}},
&stateMachine{log: []Entry{{}, {Term: 1}}},
&stateMachine{log: []Entry{{}, {Term: 1}, {Term: 3}}},
nil,
),
stateFollower,
},
// logs converge
{
newNetwork(
&stateMachine{log: []Entry{{}, {Term: 1}}},
nil,
&stateMachine{log: []Entry{{}, {Term: 2}}},
&stateMachine{log: []Entry{{}, {Term: 1}}},
nil,
),
stateLeader,
},
}
for i, tt := range tests {