diff --git a/go/vt/topo/consultopo/server.go b/go/vt/topo/consultopo/server.go index a7a5446c274..049af5bf869 100644 --- a/go/vt/topo/consultopo/server.go +++ b/go/vt/topo/consultopo/server.go @@ -165,9 +165,13 @@ func parseConsulLockSessionChecks(s string) []string { } // Close implements topo.Server.Close. -// It will nil out the global and cells fields, so any attempt to -// re-use this server will panic. +// It will close idle http connections and nil out the global +// and cells fields, so any attempt to re-use this server +// will panic. func (s *Server) Close() { + if consulConfig.Transport != nil { + consulConfig.Transport.CloseIdleConnections() + } s.client = nil s.kv = nil s.mu.Lock() diff --git a/go/vt/vttest/topoctl.go b/go/vt/vttest/topoctl.go index 2b63900d6d8..1fd4cb6e101 100644 --- a/go/vt/vttest/topoctl.go +++ b/go/vt/vttest/topoctl.go @@ -31,6 +31,7 @@ func (ctl *Topoctl) Setup() error { if err != nil { return err } + defer topoServer.Close() log.Infof("Creating cells if they don't exist in the provided topo server %s %s %s", ctl.TopoImplementation, ctl.TopoGlobalServerAddress, ctl.TopoGlobalRoot) // Create cells if it doesn't exist to be idempotent. Should work when we share the same topo server across multiple local clusters.