summaryrefslogtreecommitdiff
path: root/testutil
diff options
context:
space:
mode:
authorZiheng Liu <lzhfromustc@gmail.com>2020-02-25 17:13:25 -0500
committerZiheng Liu <lzhfromustc@gmail.com>2020-02-27 21:37:26 -0500
commitc322af8019dda164bf5af974bf446c4905674e19 (patch)
tree0800edb001d608e04b00c0e8ae2be15e81af8f99 /testutil
parentd706420b5d0f16822f4b2e9d717270728393c60c (diff)
downloaddocker-c322af8019dda164bf5af974bf446c4905674e19.tar.gz
test: add buffer to prevent goroutine leak
Signed-off-by: Ziheng Liu <lzhfromustc@gmail.com>
Diffstat (limited to 'testutil')
-rw-r--r--testutil/daemon/daemon.go3
1 files changed, 2 insertions, 1 deletions
diff --git a/testutil/daemon/daemon.go b/testutil/daemon/daemon.go
index 860ff05d7c..788dbc675e 100644
--- a/testutil/daemon/daemon.go
+++ b/testutil/daemon/daemon.go
@@ -566,13 +566,14 @@ func (d *Daemon) ReloadConfig() error {
return errors.New("daemon is not running")
}
- errCh := make(chan error)
+ errCh := make(chan error, 1)
started := make(chan struct{})
go func() {
_, body, err := request.Get("/events", request.Host(d.Sock()))
close(started)
if err != nil {
errCh <- err
+ return
}
defer body.Close()
dec := json.NewDecoder(body)