mirror of
https://github.com/etcd-io/etcd.git
synced 2024-09-27 06:25:44 +00:00
raft: make TestNodeTick reliable
TestNodeTick relies on a unreliable func `waitForSchedule` when running with GOMAXPROCS > 1. This commit changes the test to make sure we stop the node afte it drains the tick chan. The test should be reliable now.
This commit is contained in:
parent
010cc287bb
commit
931cf3454a
@ -402,7 +402,11 @@ func TestNodeTick(t *testing.T) {
|
||||
go n.run(r)
|
||||
elapsed := r.electionElapsed
|
||||
n.Tick()
|
||||
testutil.WaitSchedule()
|
||||
|
||||
for len(n.tickc) != 0 {
|
||||
time.Sleep(100 * time.Millisecond)
|
||||
}
|
||||
|
||||
n.Stop()
|
||||
if r.electionElapsed != elapsed+1 {
|
||||
t.Errorf("elapsed = %d, want %d", r.electionElapsed, elapsed+1)
|
||||
|
Loading…
x
Reference in New Issue
Block a user