diff --git a/command/agent/http_test.go b/command/agent/http_test.go index 3871ac1a986..6083779d2a4 100644 --- a/command/agent/http_test.go +++ b/command/agent/http_test.go @@ -944,11 +944,6 @@ func TestHTTPServer_Limits_Error(t *testing.T) { t.Run(name, func(t *testing.T) { t.Parallel() - // Use a fake agent since the HTTP server should never start - agent := &Agent{ - logger: testlog.HCLogger(t), - } - conf := &Config{ normalizedAddrs: &Addresses{ HTTP: "localhost:0", // port is never used @@ -962,6 +957,13 @@ func TestHTTPServer_Limits_Error(t *testing.T) { }, } + // Use a fake agent since the HTTP server should never start + agent := &Agent{ + logger: testlog.HCLogger(t), + httpLogger: testlog.HCLogger(t), + config: conf, + } + srv, err := NewHTTPServer(agent, conf) require.Error(t, err) require.Nil(t, srv)