From d5abb6db5b2497f6c4308cad3629d7621071fc12 Mon Sep 17 00:00:00 2001 From: Mike Terhar Date: Thu, 19 Dec 2024 14:08:51 +0000 Subject: [PATCH] fix linting --- .../internal/libhoneyevent/libhoneyevent_test.go | 2 +- receiver/libhoneyreceiver/receiver_test.go | 12 ++++++++---- 2 files changed, 9 insertions(+), 5 deletions(-) diff --git a/receiver/libhoneyreceiver/internal/libhoneyevent/libhoneyevent_test.go b/receiver/libhoneyreceiver/internal/libhoneyevent/libhoneyevent_test.go index c7e2098179e5..40348d2a640a 100644 --- a/receiver/libhoneyreceiver/internal/libhoneyevent/libhoneyevent_test.go +++ b/receiver/libhoneyreceiver/internal/libhoneyevent/libhoneyevent_test.go @@ -84,7 +84,7 @@ func TestLibhoneyEvent_UnmarshalJSON(t *testing.T) { require.NoError(t, err) assert.Equal(t, test.want.Data, got.Data) gotTime, timeErr := time.Parse(time.RFC3339Nano, got.Time) - assert.Nil(t, timeErr) + assert.NoError(t, timeErr) assert.WithinDuration(t, time.Now(), gotTime, time.Second) assert.Equal(t, test.want.Samplerate, got.Samplerate) assert.NotNil(t, got.MsgPackTimestamp) diff --git a/receiver/libhoneyreceiver/receiver_test.go b/receiver/libhoneyreceiver/receiver_test.go index 381785aa9916..31674c515b11 100644 --- a/receiver/libhoneyreceiver/receiver_test.go +++ b/receiver/libhoneyreceiver/receiver_test.go @@ -198,7 +198,8 @@ func TestLibhoneyReceiver_AuthEndpoint(t *testing.T) { ts := httptest.NewServer(http.HandlerFunc(func(w http.ResponseWriter, r *http.Request) { assert.Equal(t, tt.apiKey, r.Header.Get("x-honeycomb-team")) w.WriteHeader(tt.mockResponse.StatusCode) - io.Copy(w, tt.mockResponse.Body) + _, err := io.Copy(w, tt.mockResponse.Body) + assert.NoError(t, err, "failed to copy response body") })) defer ts.Close() @@ -206,9 +207,12 @@ func TestLibhoneyReceiver_AuthEndpoint(t *testing.T) { req.Header.Set("x-honeycomb-team", tt.apiKey) w := httptest.NewRecorder() - r.server = &http.Server{Handler: http.HandlerFunc(func(resp http.ResponseWriter, req *http.Request) { - r.handleAuth(resp, req) - })} + r.server = &http.Server{ + Handler: http.HandlerFunc(func(resp http.ResponseWriter, req *http.Request) { + r.handleAuth(resp, req) + }), + ReadHeaderTimeout: 3 * time.Second, + } resp := w.Result() assert.Equal(t, tt.expectedStatus, resp.StatusCode)