Explorar o código

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.
Xiang Li %!s(int64=11) %!d(string=hai) anos
pai
achega
978d0f1ca1
Modificáronse 1 ficheiros con 3 adicións e 0 borrados
  1. 3 0
      etcdserver/server_test.go

+ 3 - 0
etcdserver/server_test.go

@@ -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()