ignore err checks in test
This commit is contained in:
@@ -14,6 +14,7 @@ import (
|
|||||||
)
|
)
|
||||||
|
|
||||||
var (
|
var (
|
||||||
|
//nolint:errcheck //ephemeral no need to check
|
||||||
mirrorOK = http.HandlerFunc(func(w http.ResponseWriter, r *http.Request) { fmt.Fprint(w, "fake pkg data") })
|
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) })
|
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
|
var calls atomic.Int32
|
||||||
return http.HandlerFunc(func(w http.ResponseWriter, r *http.Request) {
|
return http.HandlerFunc(func(w http.ResponseWriter, r *http.Request) {
|
||||||
calls.Add(1)
|
calls.Add(1)
|
||||||
|
//nolint:errcheck //ephemeral no need to check
|
||||||
fmt.Fprint(w, "fake pkg data")
|
fmt.Fprint(w, "fake pkg data")
|
||||||
}), &calls
|
}), &calls
|
||||||
}
|
}
|
||||||
|
|||||||
Vendored
+5
@@ -43,6 +43,7 @@ func TestCacheHit(t *testing.T) {
|
|||||||
if err != nil {
|
if err != nil {
|
||||||
t.Fatalf("failed to fetch file: %v", err)
|
t.Fatalf("failed to fetch file: %v", err)
|
||||||
}
|
}
|
||||||
|
//nolint:errcheck //ephemeral no need to check
|
||||||
defer cachedFile.Reader.Close()
|
defer cachedFile.Reader.Close()
|
||||||
|
|
||||||
if cachedFile.Filename != tmpFileName {
|
if cachedFile.Filename != tmpFileName {
|
||||||
@@ -57,6 +58,7 @@ func TestCacheHit(t *testing.T) {
|
|||||||
if err != nil {
|
if err != nil {
|
||||||
t.Fatalf("error reading file back: %v", err)
|
t.Fatalf("error reading file back: %v", err)
|
||||||
}
|
}
|
||||||
|
//nolint:errcheck //ephemeral no need to check
|
||||||
defer cachedFile.Reader.Close()
|
defer cachedFile.Reader.Close()
|
||||||
|
|
||||||
if !bytes.Equal(data, []byte(expected)) {
|
if !bytes.Equal(data, []byte(expected)) {
|
||||||
@@ -68,6 +70,7 @@ func TestCacheMissExists(t *testing.T) {
|
|||||||
const expected = "This is fake file contents"
|
const expected = "This is fake file contents"
|
||||||
|
|
||||||
svr := newTestServer(t, http.HandlerFunc(func(w http.ResponseWriter, r *http.Request) {
|
svr := newTestServer(t, http.HandlerFunc(func(w http.ResponseWriter, r *http.Request) {
|
||||||
|
//nolint:errcheck //ephemeral no need to check
|
||||||
fmt.Fprint(w, expected)
|
fmt.Fprint(w, expected)
|
||||||
}))
|
}))
|
||||||
|
|
||||||
@@ -127,6 +130,7 @@ func TestFetchSrvDead(t *testing.T) {
|
|||||||
case <-r.Context().Done():
|
case <-r.Context().Done():
|
||||||
return
|
return
|
||||||
case <-time.After(60 * time.Second):
|
case <-time.After(60 * time.Second):
|
||||||
|
//nolint:errcheck //ephemeral no need to check
|
||||||
fmt.Fprint(w, "too late")
|
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) {
|
svr2 := newTestServer(t, http.HandlerFunc(func(w http.ResponseWriter, r *http.Request) {
|
||||||
|
//nolint:errcheck //ephemeral no need to check
|
||||||
fmt.Fprint(w, expected)
|
fmt.Fprint(w, expected)
|
||||||
}))
|
}))
|
||||||
fakeURLs := []string{
|
fakeURLs := []string{
|
||||||
|
|||||||
Reference in New Issue
Block a user