mirror of
https://github.com/k3s-io/kubernetes.git
synced 2025-08-10 04:27:54 +00:00
Properly close http connection on TestList
If not, using `go test -count=n` would make them pile up and ultimately get to the limit of open files: apiserver_test.go:984: 17: unexpected error: Get http://127.0.0.1:44131/apis/test.group/version/simple: dial tcp 127.0.0.1:44131: socket: too many open files Steps to reproduce (no longer fails): godep go test -short -run '^$' -o test . ./test -test.run '^TestList$' -test.count 100 Note that this might not fail if your `ulimit -n` is not low enough.
This commit is contained in:
parent
ee8598fd91
commit
5ec087fa30
@ -984,6 +984,7 @@ func TestList(t *testing.T) {
|
||||
t.Errorf("%d: unexpected error: %v", i, err)
|
||||
continue
|
||||
}
|
||||
defer resp.Body.Close()
|
||||
if resp.StatusCode != http.StatusOK {
|
||||
t.Errorf("%d: unexpected status: %d from url %s, Expected: %d, %#v", i, resp.StatusCode, testCase.url, http.StatusOK, resp)
|
||||
body, err := ioutil.ReadAll(resp.Body)
|
||||
|
Loading…
Reference in New Issue
Block a user