mirror of
https://github.com/moby/moby.git
synced 2022-11-09 12:21:53 -05:00
Fix tests creating zombie processes
Signed-off-by: Kenfe-Mickael Laventure <mickael.laventure@gmail.com>
This commit is contained in:
parent
ddae20c032
commit
617f89b9a3
7 changed files with 14 additions and 6 deletions
|
@ -49,6 +49,7 @@ import (
|
|||
func (s *DockerDaemonSuite) TestLegacyDaemonCommand(c *check.C) {
|
||||
cmd := exec.Command(dockerBinary, "daemon", "--storage-driver=vfs", "--debug")
|
||||
err := cmd.Start()
|
||||
go cmd.Wait()
|
||||
c.Assert(err, checker.IsNil, check.Commentf("could not start daemon using 'docker daemon'"))
|
||||
|
||||
c.Assert(cmd.Process.Kill(), checker.IsNil)
|
||||
|
|
|
@ -229,18 +229,18 @@ func (s *DockerSuite) TestExecStopNotHanging(c *check.C) {
|
|||
testRequires(c, DaemonIsLinux)
|
||||
dockerCmd(c, "run", "-d", "--name", "testing", "busybox", "top")
|
||||
|
||||
err := exec.Command(dockerBinary, "exec", "testing", "top").Start()
|
||||
c.Assert(err, checker.IsNil)
|
||||
result := icmd.StartCmd(icmd.Command(dockerBinary, "exec", "testing", "top"))
|
||||
result.Assert(c, icmd.Success)
|
||||
go icmd.WaitOnCmd(0, result)
|
||||
|
||||
type dstop struct {
|
||||
out []byte
|
||||
out string
|
||||
err error
|
||||
}
|
||||
|
||||
ch := make(chan dstop)
|
||||
go func() {
|
||||
out, err := exec.Command(dockerBinary, "stop", "testing").CombinedOutput()
|
||||
ch <- dstop{out, err}
|
||||
result := icmd.RunCommand(dockerBinary, "stop", "testing")
|
||||
ch <- dstop{result.Combined(), result.Error}
|
||||
close(ch)
|
||||
}()
|
||||
select {
|
||||
|
|
|
@ -280,6 +280,7 @@ func (s *DockerSuite) TestLogsFollowGoroutinesWithStdout(c *check.C) {
|
|||
r, w := io.Pipe()
|
||||
cmd.Stdout = w
|
||||
c.Assert(cmd.Start(), checker.IsNil)
|
||||
go cmd.Wait()
|
||||
|
||||
// Make sure pipe is written to
|
||||
chErr := make(chan error)
|
||||
|
@ -305,6 +306,7 @@ func (s *DockerSuite) TestLogsFollowGoroutinesNoOutput(c *check.C) {
|
|||
c.Assert(err, checker.IsNil)
|
||||
cmd := exec.Command(dockerBinary, "logs", "-f", id)
|
||||
c.Assert(cmd.Start(), checker.IsNil)
|
||||
go cmd.Wait()
|
||||
time.Sleep(200 * time.Millisecond)
|
||||
c.Assert(cmd.Process.Kill(), checker.IsNil)
|
||||
cmd.Wait()
|
||||
|
|
|
@ -244,6 +244,7 @@ func (s *DockerHubPullSuite) TestPullClientDisconnect(c *check.C) {
|
|||
c.Assert(err, checker.IsNil)
|
||||
err = pullCmd.Start()
|
||||
c.Assert(err, checker.IsNil)
|
||||
go pullCmd.Wait()
|
||||
|
||||
// Cancel as soon as we get some output.
|
||||
buf := make([]byte, 10)
|
||||
|
|
|
@ -226,6 +226,7 @@ func (s *DockerSuite) TestRunAttachDetachFromInvalidFlag(c *check.C) {
|
|||
if err := cmd.Start(); err != nil {
|
||||
c.Fatal(err)
|
||||
}
|
||||
go cmd.Wait()
|
||||
|
||||
bufReader := bufio.NewReader(stdout)
|
||||
out, err := bufReader.ReadString('\n')
|
||||
|
@ -424,6 +425,7 @@ func (s *DockerSuite) TestRunAttachInvalidDetachKeySequencePreserved(c *check.C)
|
|||
if err := cmd.Start(); err != nil {
|
||||
c.Fatal(err)
|
||||
}
|
||||
go cmd.Wait()
|
||||
c.Assert(waitRun(name), check.IsNil)
|
||||
|
||||
// Invalid escape sequence aba, should print aba in output
|
||||
|
|
|
@ -172,6 +172,7 @@ func (s *DockerSwarmSuite) TestServiceLogsFollow(c *check.C) {
|
|||
cmd.Stdout = w
|
||||
cmd.Stderr = w
|
||||
c.Assert(cmd.Start(), checker.IsNil)
|
||||
go cmd.Wait()
|
||||
|
||||
// Make sure pipe is written to
|
||||
ch := make(chan *logMessage)
|
||||
|
|
|
@ -131,6 +131,7 @@ func (s *DockerSuite) TestStatsAllNewContainersAdded(c *check.C) {
|
|||
stdout, err := statsCmd.StdoutPipe()
|
||||
c.Assert(err, check.IsNil)
|
||||
c.Assert(statsCmd.Start(), check.IsNil)
|
||||
go statsCmd.Wait()
|
||||
defer statsCmd.Process.Kill()
|
||||
|
||||
go func() {
|
||||
|
|
Loading…
Reference in a new issue