From 916707fa76132ec030812500268cea1f3981b788 Mon Sep 17 00:00:00 2001 From: Alex Boten <223565+codeboten@users.noreply.github.com> Date: Tue, 21 May 2024 11:14:13 -0700 Subject: [PATCH] [chore] fix leak in test This will allow enabling of goleak checks for the package. Signed-off-by: Alex Boten <223565+codeboten@users.noreply.github.com> --- service/service_test.go | 4 ++-- 1 file changed, 2 insertions(+), 2 deletions(-) diff --git a/service/service_test.go b/service/service_test.go index c538dc0027e..f8c0ad4dc4f 100644 --- a/service/service_test.go +++ b/service/service_test.go @@ -320,9 +320,9 @@ func TestServiceTelemetryRestart(t *testing.T) { // check telemetry server to ensure we get a response var resp *http.Response - // #nosec G107 resp, err = http.Get(telemetryURL) assert.NoError(t, err) + assert.NoError(t, resp.Body.Close()) assert.Equal(t, http.StatusOK, resp.StatusCode) // Shutdown the service @@ -338,8 +338,8 @@ func TestServiceTelemetryRestart(t *testing.T) { // check telemetry server to ensure we get a response require.Eventually(t, func() bool { - // #nosec G107 resp, err = http.Get(telemetryURL) + assert.NoError(t, resp.Body.Close()) return err == nil }, 500*time.Millisecond,