From 97e90af7c43aace3649ba18e21ad520c75a94f3b Mon Sep 17 00:00:00 2001 From: Kacper Sawicki Date: Mon, 2 Feb 2026 11:46:41 +0000 Subject: [PATCH] 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. --- logger_test.go | 4 +++- 1 file changed, 3 insertions(+), 1 deletion(-) diff --git a/logger_test.go b/logger_test.go index ac26049..163fd15 100644 --- a/logger_test.go +++ b/logger_test.go @@ -1236,11 +1236,12 @@ func newFakeAgentAPI(t *testing.T) *fakeAgentAPI { rtr.ServeHTTP(w, r) })) + t.Cleanup(fakeAPI.server.Close) return fakeAPI } -func newFailingAgentAPI(_ *testing.T) *fakeAgentAPI { +func newFailingAgentAPI(t *testing.T) *fakeAgentAPI { fakeAPI := &fakeAgentAPI{ disconnect: make(chan struct{}), logs: make(chan []*proto.Log), @@ -1251,6 +1252,7 @@ func newFailingAgentAPI(_ *testing.T) *fakeAgentAPI { fakeAPI.server = httptest.NewServer(http.HandlerFunc(func(w http.ResponseWriter, _ *http.Request) { http.Error(w, "Unauthorized", http.StatusUnauthorized) })) + t.Cleanup(fakeAPI.server.Close) return fakeAPI }