Skip to content

Commit e64f1a9

Browse files
committed
config: fix test-only failures in UI handler setup
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.
1 parent 53ab5ea commit e64f1a9

File tree

1 file changed

+7
-5
lines changed

1 file changed

+7
-5
lines changed

command/agent/http_test.go

+7-5
Original file line numberDiff line numberDiff line change
@@ -944,11 +944,6 @@ func TestHTTPServer_Limits_Error(t *testing.T) {
944944
t.Run(name, func(t *testing.T) {
945945
t.Parallel()
946946

947-
// Use a fake agent since the HTTP server should never start
948-
agent := &Agent{
949-
logger: testlog.HCLogger(t),
950-
}
951-
952947
conf := &Config{
953948
normalizedAddrs: &Addresses{
954949
HTTP: "localhost:0", // port is never used
@@ -962,6 +957,13 @@ func TestHTTPServer_Limits_Error(t *testing.T) {
962957
},
963958
}
964959

960+
// Use a fake agent since the HTTP server should never start
961+
agent := &Agent{
962+
logger: testlog.HCLogger(t),
963+
httpLogger: testlog.HCLogger(t),
964+
config: conf,
965+
}
966+
965967
srv, err := NewHTTPServer(agent, conf)
966968
require.Error(t, err)
967969
require.Nil(t, srv)

0 commit comments

Comments
 (0)