From 61eb5a10440a8313c73a7ff88602380872bff2ce Mon Sep 17 00:00:00 2001 From: Martin Angers <martin.n.angers@gmail.com> Date: Mon, 4 Sep 2017 12:08:58 -0400 Subject: [PATCH] fix test by not using Go1.7-only httptest.ResponseRecorder.Result() --- fetch_test.go | 5 ++--- 1 file changed, 2 insertions(+), 3 deletions(-) diff --git a/fetch_test.go b/fetch_test.go index 6c9019a..650bcca 100644 --- a/fetch_test.go +++ b/fetch_test.go @@ -734,8 +734,7 @@ func TestGoroLeak(t *testing.T) { })) f.HttpClient = doerFunc(func(req *http.Request) (*http.Response, error) { - res := httptest.NewRecorder() - return res.Result(), nil + return &http.Response{Request: req, StatusCode: 200}, nil }) f.DisablePoliteness = true @@ -780,7 +779,7 @@ func TestGoroLeak(t *testing.T) { t.Errorf("want at least 10 and no more than 100 handler calls, got %d", callCount) } // should have the same number of goroutines as there was at the start - if startGoros != cancelGoros { + if startGoros < cancelGoros { t.Errorf("want %d goros like there was at the start, got %d (leak)", startGoros, cancelGoros) }