Close idle MetaClient http connections

Prevents too many open files when running tests
pull/5428/head
Jason Wilder 2016-01-19 20:33:07 -07:00 committed by David Norton
parent ad52d0fbd9
commit b7e1ecf471
3 changed files with 7 additions and 2 deletions

View File

@ -96,7 +96,9 @@ func OpenDefaultServer(c *run.Config, joinURLs string) *Server {
// Close shuts down the server and removes all temporary paths.
func (s *Server) Close() {
s.Server.Close()
if err := s.Server.Close(); err != nil {
panic(err.Error())
}
os.RemoveAll(s.Config.Meta.Dir)
os.RemoveAll(s.Config.Data.Dir)
os.RemoveAll(s.Config.HintedHandoff.Dir)

View File

@ -4573,7 +4573,6 @@ func TestServer_Query_Chunk(t *testing.T) {
t.Error(query.failureMessage())
}
}
}
func TestServer_Query_DropAndRecreateMeasurement(t *testing.T) {

View File

@ -101,6 +101,10 @@ func (c *Client) Close() error {
c.mu.Lock()
defer c.mu.Unlock()
if t, ok := http.DefaultTransport.(*http.Transport); ok {
t.CloseIdleConnections()
}
select {
case <-c.closing:
return nil