From c8ad31161b3868f0de14265be4b35b59ac8fc00f Mon Sep 17 00:00:00 2001 From: Wojciech Tyczynski Date: Wed, 30 Dec 2015 08:21:50 +0100 Subject: [PATCH] Workaround races while closing etcd server. --- pkg/storage/etcd/testing/utils.go | 7 +++++++ 1 file changed, 7 insertions(+) diff --git a/pkg/storage/etcd/testing/utils.go b/pkg/storage/etcd/testing/utils.go index c45dd115d95..6185b36b6f1 100644 --- a/pkg/storage/etcd/testing/utils.go +++ b/pkg/storage/etcd/testing/utils.go @@ -146,6 +146,13 @@ func (m *EtcdTestServer) waitUntilUp() error { func (m *EtcdTestServer) Terminate(t *testing.T) { m.Client = nil m.s.Stop() + // TODO: This is a pretty ugly hack to workaround races during closing + // in-memory etcd server in unit tests - see #18928 for more details. + // We should get rid of it as soon as we have a proper fix - etcd clients + // have overwritten transport counting opened connections (probably by + // overwriting Dial function) and termination function waiting for all + // connections to be closed and stopping accepting new ones. + time.Sleep(250 * time.Millisecond) for _, hs := range m.hss { hs.CloseClientConnections() hs.Close()