Skip to content

Commit

Permalink
config: fix test-only failures in UI handler setup (#11571)
Browse files Browse the repository at this point in the history
The `TestHTTPServer_Limits_Error` test never starts the agent so it
had an incomplete configuration, which caused panics in the test. Fix
the configuration.

The PR #11555 had a branch name like `f-ui-*` which caused CI to skip
the unit tests over the HTTP handler setup, so this wasn't caught in
PR review.
  • Loading branch information
tgross committed Nov 24, 2021
1 parent f9871fb commit 5b418a1
Showing 1 changed file with 7 additions and 5 deletions.
12 changes: 7 additions & 5 deletions command/agent/http_test.go
Original file line number Diff line number Diff line change
Expand Up @@ -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
Expand All @@ -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)
Expand Down

0 comments on commit 5b418a1

Please sign in to comment.