diff --git a/command/agent/command.go b/command/agent/command.go index 4cf6e7b60..df47de38c 100644 --- a/command/agent/command.go +++ b/command/agent/command.go @@ -350,7 +350,7 @@ func (c *Command) setupAgent(config *Config, logOutput io.Writer) error { } // Setup the HTTP server - http, err := NewHTTPServer(agent, config, logOutput) + http, err := NewHTTPServer(agent, config) if err != nil { agent.Shutdown() c.Ui.Error(fmt.Sprintf("Error starting http server: %s", err)) diff --git a/command/agent/http.go b/command/agent/http.go index cdeb05741..8dbfca78e 100644 --- a/command/agent/http.go +++ b/command/agent/http.go @@ -5,7 +5,6 @@ import ( "crypto/tls" "encoding/json" "fmt" - "io" "log" "net" "net/http" @@ -52,7 +51,7 @@ type HTTPServer struct { } // NewHTTPServer starts new HTTP server over the agent -func NewHTTPServer(agent *Agent, config *Config, logOutput io.Writer) (*HTTPServer, error) { +func NewHTTPServer(agent *Agent, config *Config) (*HTTPServer, error) { // Start the listener lnAddr, err := net.ResolveTCPAddr("tcp", config.normalizedAddrs.HTTP) if err != nil { diff --git a/command/agent/http_test.go b/command/agent/http_test.go index 34f37dcdf..de27c47c4 100644 --- a/command/agent/http_test.go +++ b/command/agent/http_test.go @@ -31,25 +31,11 @@ func (s *TestServer) Cleanup() { os.RemoveAll(s.Dir) } -// makeHTTPServerNoLogs returns a test server with full logging. -func makeHTTPServer(t testing.TB, cb func(c *Config)) *TestServer { - return makeHTTPServerWithWriter(t, nil, cb) -} - -// makeHTTPServerNoLogs returns a test server which only prints agent logs and -// no http server logs -func makeHTTPServerNoLogs(t testing.TB, cb func(c *Config)) *TestServer { - return makeHTTPServerWithWriter(t, ioutil.Discard, cb) -} - -// makeHTTPServerWithWriter returns a test server whose logs will be written to +// makeHTTPServer returns a test server whose logs will be written to // the passed writer. If the writer is nil, the logs are written to stderr. -func makeHTTPServerWithWriter(t testing.TB, w io.Writer, cb func(c *Config)) *TestServer { +func makeHTTPServer(t testing.TB, cb func(c *Config)) *TestServer { dir, agent := makeAgent(t, cb) - if w == nil { - w = agent.logOutput - } - srv, err := NewHTTPServer(agent, agent.config, w) + srv, err := NewHTTPServer(agent, agent.config) if err != nil { t.Fatalf("err: %v", err) } @@ -63,7 +49,7 @@ func makeHTTPServerWithWriter(t testing.TB, w io.Writer, cb func(c *Config)) *Te } func BenchmarkHTTPRequests(b *testing.B) { - s := makeHTTPServerNoLogs(b, func(c *Config) { + s := makeHTTPServer(b, func(c *Config) { c.Client.Enabled = false }) defer s.Cleanup()