From 3ec3ffbef09e7d9f67f2070c4b4cbca2af15f660 Mon Sep 17 00:00:00 2001 From: Xiang Li Date: Wed, 2 Dec 2015 13:18:08 -0800 Subject: [PATCH] etcdserver: get rid of unreliable WaitSchedule In this case, we know we are waiting for an action happened on storage. We can do a busy wait instead of calling waitSchedule. The test previously failed on CI with no observed actions. --- etcdserver/server_test.go | 11 +++++++++-- 1 file changed, 9 insertions(+), 2 deletions(-) diff --git a/etcdserver/server_test.go b/etcdserver/server_test.go index 80beb374f..23763deba 100644 --- a/etcdserver/server_test.go +++ b/etcdserver/server_test.go @@ -849,8 +849,15 @@ func TestRecvSnapshot(t *testing.T) { s.start() n.readyc <- raft.Ready{Snapshot: raftpb.Snapshot{Metadata: raftpb.SnapshotMetadata{Index: 1}}} - // make goroutines move forward to receive snapshot - testutil.WaitSchedule() + + // wait for actions happened on the storage + for { + if len(p.Action()) != 0 { + break + } + time.Sleep(10 * time.Millisecond) + } + s.Stop() wactions := []testutil.Action{{Name: "Recovery"}}