diff options
author | Ziheng Liu <lzhfromustc@gmail.com> | 2020-02-25 17:13:25 -0500 |
---|---|---|
committer | Ziheng Liu <lzhfromustc@gmail.com> | 2020-02-27 21:37:26 -0500 |
commit | c322af8019dda164bf5af974bf446c4905674e19 (patch) | |
tree | 0800edb001d608e04b00c0e8ae2be15e81af8f99 /integration-cli/docker_api_attach_test.go | |
parent | d706420b5d0f16822f4b2e9d717270728393c60c (diff) | |
download | docker-c322af8019dda164bf5af974bf446c4905674e19.tar.gz |
test: add buffer to prevent goroutine leak
Signed-off-by: Ziheng Liu <lzhfromustc@gmail.com>
Diffstat (limited to 'integration-cli/docker_api_attach_test.go')
-rw-r--r-- | integration-cli/docker_api_attach_test.go | 6 |
1 files changed, 3 insertions, 3 deletions
diff --git a/integration-cli/docker_api_attach_test.go b/integration-cli/docker_api_attach_test.go index 2627821cc1..76b78b7010 100644 --- a/integration-cli/docker_api_attach_test.go +++ b/integration-cli/docker_api_attach_test.go @@ -43,14 +43,14 @@ func (s *DockerSuite) TestGetContainersAttachWebsocket(c *testing.T) { expected := []byte("hello") actual := make([]byte, len(expected)) - outChan := make(chan error) + outChan := make(chan error, 1) go func() { _, err := io.ReadFull(ws, actual) outChan <- err close(outChan) }() - inChan := make(chan error) + inChan := make(chan error, 1) go func() { _, err := ws.Write(expected) inChan <- err @@ -278,7 +278,7 @@ func bodyIsWritable(r *http.Response) bool { // readTimeout read from io.Reader with timeout func readTimeout(r io.Reader, buf []byte, timeout time.Duration) (n int, err error) { - ch := make(chan bool) + ch := make(chan bool, 1) go func() { n, err = io.ReadFull(r, buf) ch <- true |