1
0
mirror of https://github.com/moby/moby.git synced 2026-01-06 07:21:23 +03:00

Merge pull request #5464 from tianon/close-leftover-fds

This commit is contained in:
Michael Crosby
2014-04-30 12:27:52 -07:00
7 changed files with 80 additions and 18 deletions

View File

@@ -92,6 +92,22 @@ func TestDockerRunEchoNamedContainer(t *testing.T) {
logDone("run - echo with named container")
}
// docker run should not leak file descriptors
func TestDockerRunLeakyFileDescriptors(t *testing.T) {
runCmd := exec.Command(dockerBinary, "run", "busybox", "ls", "-C", "/proc/self/fd")
out, _, _, err := runCommandWithStdoutStderr(runCmd)
errorOut(err, t, out)
// normally, we should only get 0, 1, and 2, but 3 gets created by "ls" when it does "opendir" on the "fd" directory
if out != "0 1 2 3\n" {
t.Errorf("container should've printed '0 1 2 3', not: %s", out)
}
deleteAllContainers()
logDone("run - check file descriptor leakage")
}
// it should be possible to ping Google DNS resolver
// this will fail when Internet access is unavailable
func TestDockerRunPingGoogle(t *testing.T) {