mirror of
https://github.com/etcd-io/etcd.git
synced 2024-09-27 06:25:44 +00:00
tests: fix the logic of testNonleaderElectionTimeoutRandomized in raft_paper_test.go
In the test `testNonleaderElectionTimeoutRandomized`, the possible values of election timeout randomized out should be 10-19(inclusive), but the current test only tests the possible values as 11-19(inclusive), which is incorrect here. We need to expand the scope of the tests to ensure robustness, and also to make the logic clearer. Signed-off-by: Zike Yang <zike@apache.org>
This commit is contained in:
parent
08f4c340eb
commit
b77f56ac25
@ -325,7 +325,7 @@ func testNonleaderElectionTimeoutRandomized(t *testing.T, state StateType) {
|
||||
timeouts[time] = true
|
||||
}
|
||||
|
||||
for d := et + 1; d < 2*et; d++ {
|
||||
for d := et; d < 2*et; d++ {
|
||||
if !timeouts[d] {
|
||||
t.Errorf("timeout in %d ticks should happen", d)
|
||||
}
|
||||
|
Loading…
x
Reference in New Issue
Block a user