etcdserver: fix TestDoProposalStopped test

We start etcd server in this test without the cluster. Sometimes it panics when
accessing the cluster. Most of the time it does not panic, since we can stop the
server fast enough before applying the first configuration change entry.
This commit is contained in:
Xiang Li 2014-11-13 14:08:59 -08:00
parent fb344bc33f
commit 978d0f1ca1

View File

@ -677,6 +677,8 @@ func TestDoProposalStopped(t *testing.T) {
tk := make(chan time.Time)
// this makes <-tk always successful, which accelarates internal clock
close(tk)
cl := newCluster("abc")
cl.SetStore(store.New())
srv := &EtcdServer{
// TODO: use fake node for better testability
node: n,
@ -684,6 +686,7 @@ func TestDoProposalStopped(t *testing.T) {
sender: &nopSender{},
storage: &storageRecorder{},
Ticker: tk,
Cluster: cl,
}
srv.start()