From 2cfbd31f588f105dda5adcb6ea9cc1b7af091134 Mon Sep 17 00:00:00 2001 From: rekby Date: Sun, 24 Nov 2019 14:48:03 +0300 Subject: [PATCH] style --- internal/profiler/profiler_test.go | 5 +---- internal/profiler/secret_handler_test.go | 3 +++ 2 files changed, 4 insertions(+), 4 deletions(-) diff --git a/internal/profiler/profiler_test.go b/internal/profiler/profiler_test.go index 3ad8356c..4df89d10 100644 --- a/internal/profiler/profiler_test.go +++ b/internal/profiler/profiler_test.go @@ -11,8 +11,6 @@ import ( ) func TestNew(t *testing.T) { - const argName = "pass" - const pass = "qwe" td := testdeep.NewT(t) profiler := New(zap.NewNop(), Config{AllowedNetworks: []string{"127.0.0.1/32", "::1/128"}}) td.Len(profiler.secretHandler.AllowedNetworks, 2) @@ -21,8 +19,6 @@ func TestNew(t *testing.T) { } func TestProfiler_ServeHTTP(t *testing.T) { - const argName = "pass" - const pass = "qwe" td := testdeep.NewT(t) profiler := New(zap.NewNop(), Config{AllowedNetworks: []string{"127.0.0.1/32", "::1/128"}}) @@ -34,4 +30,5 @@ func TestProfiler_ServeHTTP(t *testing.T) { resp := respWriter.Result() td.Cmp(resp.StatusCode, http.StatusOK) td.True(strings.Contains(resp.Header.Get("content-type"), "text/html")) + _ = resp.Body.Close() } diff --git a/internal/profiler/secret_handler_test.go b/internal/profiler/secret_handler_test.go index f098a41a..5ab9b528 100644 --- a/internal/profiler/secret_handler_test.go +++ b/internal/profiler/secret_handler_test.go @@ -45,6 +45,7 @@ func TestSecretHandler_ServeHTTP(t *testing.T) { resp := respWriter.Result() td.Cmp(resp.StatusCode, http.StatusOK) td.True(nextCalled) + _ = resp.Body.Close() nextCalled = false respWriter = httptest.NewRecorder() @@ -56,6 +57,7 @@ func TestSecretHandler_ServeHTTP(t *testing.T) { td.Cmp(resp.StatusCode, http.StatusForbidden) td.False(nextCalled) nextCalled = false + _ = resp.Body.Close() nextCalled = false respWriter = httptest.NewRecorder() @@ -67,4 +69,5 @@ func TestSecretHandler_ServeHTTP(t *testing.T) { td.Cmp(resp.StatusCode, http.StatusInternalServerError) td.False(nextCalled) nextCalled = false + _ = resp.Body.Close() }