1
0
mirror of https://github.com/moby/moby.git synced 2025-11-03 16:33:18 +03:00

test: add buffer to prevent goroutine leak

Signed-off-by: Ziheng Liu <lzhfromustc@gmail.com>
This commit is contained in:
Ziheng Liu
2020-02-25 17:13:25 -05:00
parent d706420b5d
commit c322af8019
22 changed files with 63 additions and 45 deletions

View File

@@ -33,7 +33,7 @@ func (s *DockerSuite) TestAttachClosedOnContainerStop(c *testing.T) {
err = attachCmd.Start()
assert.NilError(c, err)
errChan := make(chan error)
errChan := make(chan error, 1)
go func() {
time.Sleep(300 * time.Millisecond)
defer close(errChan)
@@ -68,7 +68,7 @@ func (s *DockerSuite) TestAttachAfterDetach(c *testing.T) {
cmd.Stdout = tty
cmd.Stderr = tty
cmdExit := make(chan error)
cmdExit := make(chan error, 1)
go func() {
cmdExit <- cmd.Run()
close(cmdExit)