release-3.1
swingbach@gmail.com 2016-08-04 18:31:22 +08:00
parent c0a8da7fd0
commit 41dee84733
1 changed files with 5 additions and 0 deletions

View File

@ -1295,6 +1295,10 @@ func TestLeaderElectionWithCheckQuorum(t *testing.T) {
t.Errorf("state = %s, want %s", c.state, StateFollower)
}
// need to reset randomizedElectionTimeout larger than electionTimeout again,
// because the value might be reset to electionTimeout since the last state changes
setRandomizedElectionTimeout(a, a.electionTimeout+1)
setRandomizedElectionTimeout(b, b.electionTimeout+2)
for i := 0; i < a.electionTimeout; i++ {
a.tick()
}
@ -2225,6 +2229,7 @@ func TestLeaderTransferWithCheckQuorum(t *testing.T) {
for i := 1; i < 4; i++ {
r := nt.peers[uint64(i)].(*raft)
r.checkQuorum = true
setRandomizedElectionTimeout(r, r.electionTimeout+i)
}
// Letting peer 2 electionElapsed reach to timeout so that it can vote for peer 1