mirror of
https://github.com/etcd-io/etcd.git
synced 2024-09-27 06:25:44 +00:00
raft: fix #6068
This commit is contained in:
parent
e2088b8073
commit
992f628e6e
@ -1278,6 +1278,12 @@ func TestLeaderElectionWithCheckQuorum(t *testing.T) {
|
||||
b.checkQuorum = true
|
||||
c.checkQuorum = true
|
||||
|
||||
// we can not let system choosing the value of randomizedElectionTimeout
|
||||
// otherwise it will introduce some uncertainty into this test case
|
||||
// we need to ensure randomizedElectionTimeout > electionTimeout here
|
||||
a.randomizedElectionTimeout = a.electionTimeout + 1
|
||||
b.randomizedElectionTimeout = b.electionTimeout + 2
|
||||
|
||||
nt := newNetwork(a, b, c)
|
||||
|
||||
// Letting b's electionElapsed reach to timeout so that it can vote for a
|
||||
@ -1323,6 +1329,11 @@ func TestFreeStuckCandidateWithCheckQuorum(t *testing.T) {
|
||||
b.checkQuorum = true
|
||||
c.checkQuorum = true
|
||||
|
||||
// we can not let system choosing the value of randomizedElectionTimeout
|
||||
// otherwise it will introduce some uncertainty into this test case
|
||||
// we need to ensure randomizedElectionTimeout > electionTimeout here
|
||||
b.randomizedElectionTimeout = b.electionTimeout + 1
|
||||
|
||||
nt := newNetwork(a, b, c)
|
||||
for i := 0; i < b.electionTimeout; i++ {
|
||||
b.tick()
|
||||
@ -1379,6 +1390,11 @@ func TestNonPromotableVoterWithCheckQuorum(t *testing.T) {
|
||||
a.checkQuorum = true
|
||||
b.checkQuorum = true
|
||||
|
||||
// we can not let system choosing the value of randomizedElectionTimeout
|
||||
// otherwise it will introduce some uncertainty into this test case
|
||||
// we need to ensure randomizedElectionTimeout > electionTimeout here
|
||||
b.randomizedElectionTimeout = b.electionTimeout + 1
|
||||
|
||||
nt := newNetwork(a, b)
|
||||
// Need to remove 2 again to make it a non-promotable node since newNetwork overwritten some internal states
|
||||
b.delProgress(2)
|
||||
@ -1414,6 +1430,11 @@ func TestReadIndexWithCheckQuorum(t *testing.T) {
|
||||
b.checkQuorum = true
|
||||
c.checkQuorum = true
|
||||
|
||||
// we can not let system choosing the value of randomizedElectionTimeout
|
||||
// otherwise it will introduce some uncertainty into this test case
|
||||
// we need to ensure randomizedElectionTimeout > electionTimeout here
|
||||
b.randomizedElectionTimeout = b.electionTimeout + 1
|
||||
|
||||
nt := newNetwork(a, b, c)
|
||||
for i := 0; i < b.electionTimeout; i++ {
|
||||
b.tick()
|
||||
|
Loading…
x
Reference in New Issue
Block a user