Skip to content

Commit 97e90af

Browse files
committed
fix: close httptest servers in test cleanup
The test servers were not being closed, causing the test process to hang for up to 5 seconds waiting for connections to close. This caused the integration test job to exceed the 10-minute timeout.
1 parent 8085222 commit 97e90af

1 file changed

Lines changed: 3 additions & 1 deletion

File tree

logger_test.go

Lines changed: 3 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -1236,11 +1236,12 @@ func newFakeAgentAPI(t *testing.T) *fakeAgentAPI {
12361236

12371237
rtr.ServeHTTP(w, r)
12381238
}))
1239+
t.Cleanup(fakeAPI.server.Close)
12391240

12401241
return fakeAPI
12411242
}
12421243

1243-
func newFailingAgentAPI(_ *testing.T) *fakeAgentAPI {
1244+
func newFailingAgentAPI(t *testing.T) *fakeAgentAPI {
12441245
fakeAPI := &fakeAgentAPI{
12451246
disconnect: make(chan struct{}),
12461247
logs: make(chan []*proto.Log),
@@ -1251,6 +1252,7 @@ func newFailingAgentAPI(_ *testing.T) *fakeAgentAPI {
12511252
fakeAPI.server = httptest.NewServer(http.HandlerFunc(func(w http.ResponseWriter, _ *http.Request) {
12521253
http.Error(w, "Unauthorized", http.StatusUnauthorized)
12531254
}))
1255+
t.Cleanup(fakeAPI.server.Close)
12541256

12551257
return fakeAPI
12561258
}

0 commit comments

Comments
 (0)