mirror of
https://github.com/k3s-io/kubernetes.git
synced 2026-01-05 23:47:50 +00:00
Properly close test http servers in unversioned
If not, using `go test -count=n` would make them pile up and ultimately get to the limit of open files: client_test.go:522: expected an error, got Get http://127.0.0.1:46070/api: dial tcp 127.0.0.1:46070: socket: too many open files Steps to reproduce (no longer fails): godep go test -short -run '^$' -o test . ./test -test.run '^TestGetSwaggerSchema' -test.count 100 Note that this might not fail if your `ulimit -n` is not low enough.
This commit is contained in:
@@ -67,6 +67,7 @@ func TestLimitRangeCreate(t *testing.T) {
|
||||
}
|
||||
|
||||
response, err := c.Setup(t).LimitRanges(ns).Create(limitRange)
|
||||
defer c.Close()
|
||||
c.Validate(t, response, err)
|
||||
}
|
||||
|
||||
@@ -103,6 +104,7 @@ func TestLimitRangeGet(t *testing.T) {
|
||||
}
|
||||
|
||||
response, err := c.Setup(t).LimitRanges(ns).Get("abc")
|
||||
defer c.Close()
|
||||
c.Validate(t, response, err)
|
||||
}
|
||||
|
||||
@@ -126,6 +128,7 @@ func TestLimitRangeList(t *testing.T) {
|
||||
Response: simple.Response{StatusCode: 200, Body: limitRangeList},
|
||||
}
|
||||
response, err := c.Setup(t).LimitRanges(ns).List(api.ListOptions{})
|
||||
defer c.Close()
|
||||
c.Validate(t, response, err)
|
||||
}
|
||||
|
||||
@@ -157,6 +160,7 @@ func TestLimitRangeUpdate(t *testing.T) {
|
||||
Response: simple.Response{StatusCode: 200, Body: limitRange},
|
||||
}
|
||||
response, err := c.Setup(t).LimitRanges(ns).Update(limitRange)
|
||||
defer c.Close()
|
||||
c.Validate(t, response, err)
|
||||
}
|
||||
|
||||
@@ -187,6 +191,7 @@ func TestInvalidLimitRangeUpdate(t *testing.T) {
|
||||
Response: simple.Response{StatusCode: 200, Body: limitRange},
|
||||
}
|
||||
_, err := c.Setup(t).LimitRanges(ns).Update(limitRange)
|
||||
defer c.Close()
|
||||
if err == nil {
|
||||
t.Errorf("Expected an error due to missing ResourceVersion")
|
||||
}
|
||||
@@ -199,6 +204,7 @@ func TestLimitRangeDelete(t *testing.T) {
|
||||
Response: simple.Response{StatusCode: 200},
|
||||
}
|
||||
err := c.Setup(t).LimitRanges(ns).Delete("foo")
|
||||
defer c.Close()
|
||||
c.Validate(t, nil, err)
|
||||
}
|
||||
|
||||
@@ -211,5 +217,6 @@ func TestLimitRangeWatch(t *testing.T) {
|
||||
Response: simple.Response{StatusCode: 200},
|
||||
}
|
||||
_, err := c.Setup(t).LimitRanges(api.NamespaceAll).Watch(api.ListOptions{})
|
||||
defer c.Close()
|
||||
c.Validate(t, nil, err)
|
||||
}
|
||||
|
||||
Reference in New Issue
Block a user