mirror of
https://github.com/opencontainers/runc.git
synced 2026-02-06 03:45:41 +01:00
libct/int: add TestFdLeaksSystemd
Add a test to check that container.Run do not leak file descriptors.
Before the previous commit, it fails like this:
exec_test.go:2030: extra fd 8 -> socket:[659703]
exec_test.go:2030: extra fd 11 -> socket:[658715]
exec_test.go:2033: found 2 extra fds after container.Run
Signed-off-by: Kir Kolyshkin <kolyshkin@gmail.com>
This commit is contained in:
@@ -1917,6 +1917,14 @@ func TestCGROUPHost(t *testing.T) {
|
||||
}
|
||||
|
||||
func TestFdLeaks(t *testing.T) {
|
||||
testFdLeaks(t, false)
|
||||
}
|
||||
|
||||
func TestFdLeaksSystemd(t *testing.T) {
|
||||
testFdLeaks(t, true)
|
||||
}
|
||||
|
||||
func testFdLeaks(t *testing.T, systemd bool) {
|
||||
if testing.Short() {
|
||||
return
|
||||
}
|
||||
@@ -1933,7 +1941,10 @@ func TestFdLeaks(t *testing.T) {
|
||||
_, err = pfd.Seek(0, 0)
|
||||
ok(t, err)
|
||||
|
||||
config := newTemplateConfig(t, &tParam{rootfs: rootfs})
|
||||
config := newTemplateConfig(t, &tParam{
|
||||
rootfs: rootfs,
|
||||
systemd: systemd,
|
||||
})
|
||||
buffers, exitCode, err := runContainer(t, config, "", "true")
|
||||
ok(t, err)
|
||||
|
||||
|
||||
Reference in New Issue
Block a user