Merge pull request #19187 from wojtek-t/add_sleep_in_etcd_server

Add sleep to EtcdTestServer Terminate.
This commit is contained in:
Marek Grabowski 2016-01-04 19:29:34 +01:00
commit 4606171ad0

View File

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