Test: Add buffer to two channels to avoid blocking goroutine
Signed-off-by: Ziheng Liu <lzhfromustc@gmail.com>
This commit is contained in:
parent
e9b4655bc9
commit
d1c2f953c5
|
@ -45,7 +45,7 @@ var errCancelled = errors.New("build cancelled")
|
||||||
// Run a container by ID
|
// Run a container by ID
|
||||||
func (c *containerManager) Run(ctx context.Context, cID string, stdout, stderr io.Writer) (err error) {
|
func (c *containerManager) Run(ctx context.Context, cID string, stdout, stderr io.Writer) (err error) {
|
||||||
attached := make(chan struct{})
|
attached := make(chan struct{})
|
||||||
errCh := make(chan error)
|
errCh := make(chan error, 1)
|
||||||
go func() {
|
go func() {
|
||||||
errCh <- c.backend.ContainerAttachRaw(cID, nil, stdout, stderr, true, attached)
|
errCh <- c.backend.ContainerAttachRaw(cID, nil, stdout, stderr, true, attached)
|
||||||
}()
|
}()
|
||||||
|
|
|
@ -73,7 +73,7 @@ func TestReadPluginNoRead(t *testing.T) {
|
||||||
|
|
||||||
buf := bytes.NewBuffer(nil)
|
buf := bytes.NewBuffer(nil)
|
||||||
|
|
||||||
errCh := make(chan error)
|
errCh := make(chan error, 1)
|
||||||
go func() {
|
go func() {
|
||||||
_, err := stdcopy.StdCopy(buf, buf, logs)
|
_, err := stdcopy.StdCopy(buf, buf, logs)
|
||||||
errCh <- err
|
errCh <- err
|
||||||
|
|
Loading…
Reference in New Issue