mirror of
https://github.com/k3s-io/kubernetes.git
synced 2026-01-05 15:37:24 +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:
@@ -60,6 +60,7 @@ func TestPersistentVolumeCreate(t *testing.T) {
|
||||
}
|
||||
|
||||
response, err := c.Setup(t).PersistentVolumes().Create(pv)
|
||||
defer c.Close()
|
||||
c.Validate(t, response, err)
|
||||
}
|
||||
|
||||
@@ -89,6 +90,7 @@ func TestPersistentVolumeGet(t *testing.T) {
|
||||
}
|
||||
|
||||
response, err := c.Setup(t).PersistentVolumes().Get("abc")
|
||||
defer c.Close()
|
||||
c.Validate(t, response, err)
|
||||
}
|
||||
|
||||
@@ -110,6 +112,7 @@ func TestPersistentVolumeList(t *testing.T) {
|
||||
Response: simple.Response{StatusCode: 200, Body: persistentVolumeList},
|
||||
}
|
||||
response, err := c.Setup(t).PersistentVolumes().List(api.ListOptions{})
|
||||
defer c.Close()
|
||||
c.Validate(t, response, err)
|
||||
}
|
||||
|
||||
@@ -133,6 +136,7 @@ func TestPersistentVolumeUpdate(t *testing.T) {
|
||||
Response: simple.Response{StatusCode: 200, Body: persistentVolume},
|
||||
}
|
||||
response, err := c.Setup(t).PersistentVolumes().Update(persistentVolume)
|
||||
defer c.Close()
|
||||
c.Validate(t, response, err)
|
||||
}
|
||||
|
||||
@@ -163,6 +167,7 @@ func TestPersistentVolumeStatusUpdate(t *testing.T) {
|
||||
Response: simple.Response{StatusCode: 200, Body: persistentVolume},
|
||||
}
|
||||
response, err := c.Setup(t).PersistentVolumes().UpdateStatus(persistentVolume)
|
||||
defer c.Close()
|
||||
c.Validate(t, response, err)
|
||||
}
|
||||
|
||||
@@ -172,6 +177,7 @@ func TestPersistentVolumeDelete(t *testing.T) {
|
||||
Response: simple.Response{StatusCode: 200},
|
||||
}
|
||||
err := c.Setup(t).PersistentVolumes().Delete("foo")
|
||||
defer c.Close()
|
||||
c.Validate(t, nil, err)
|
||||
}
|
||||
|
||||
@@ -184,5 +190,6 @@ func TestPersistentVolumeWatch(t *testing.T) {
|
||||
Response: simple.Response{StatusCode: 200},
|
||||
}
|
||||
_, err := c.Setup(t).PersistentVolumes().Watch(api.ListOptions{})
|
||||
defer c.Close()
|
||||
c.Validate(t, nil, err)
|
||||
}
|
||||
|
||||
Reference in New Issue
Block a user