ignore err checks in test

This commit is contained in:
2026-05-07 08:35:05 -06:00
parent 00039b607c
commit c565a2d97a
2 changed files with 7 additions and 0 deletions
+2
View File
@@ -14,6 +14,7 @@ import (
)
var (
//nolint:errcheck //ephemeral no need to check
mirrorOK = http.HandlerFunc(func(w http.ResponseWriter, r *http.Request) { fmt.Fprint(w, "fake pkg data") })
mirror404 = http.HandlerFunc(func(w http.ResponseWriter, r *http.Request) { w.WriteHeader(http.StatusNotFound) })
)
@@ -22,6 +23,7 @@ func mirrorOKWithCounter() (http.HandlerFunc, *atomic.Int32) {
var calls atomic.Int32
return http.HandlerFunc(func(w http.ResponseWriter, r *http.Request) {
calls.Add(1)
//nolint:errcheck //ephemeral no need to check
fmt.Fprint(w, "fake pkg data")
}), &calls
}
+5
View File
@@ -43,6 +43,7 @@ func TestCacheHit(t *testing.T) {
if err != nil {
t.Fatalf("failed to fetch file: %v", err)
}
//nolint:errcheck //ephemeral no need to check
defer cachedFile.Reader.Close()
if cachedFile.Filename != tmpFileName {
@@ -57,6 +58,7 @@ func TestCacheHit(t *testing.T) {
if err != nil {
t.Fatalf("error reading file back: %v", err)
}
//nolint:errcheck //ephemeral no need to check
defer cachedFile.Reader.Close()
if !bytes.Equal(data, []byte(expected)) {
@@ -68,6 +70,7 @@ func TestCacheMissExists(t *testing.T) {
const expected = "This is fake file contents"
svr := newTestServer(t, http.HandlerFunc(func(w http.ResponseWriter, r *http.Request) {
//nolint:errcheck //ephemeral no need to check
fmt.Fprint(w, expected)
}))
@@ -127,6 +130,7 @@ func TestFetchSrvDead(t *testing.T) {
case <-r.Context().Done():
return
case <-time.After(60 * time.Second):
//nolint:errcheck //ephemeral no need to check
fmt.Fprint(w, "too late")
}
}))
@@ -152,6 +156,7 @@ func TestFetchRetryExists(t *testing.T) {
}))
svr2 := newTestServer(t, http.HandlerFunc(func(w http.ResponseWriter, r *http.Request) {
//nolint:errcheck //ephemeral no need to check
fmt.Fprint(w, expected)
}))
fakeURLs := []string{