Skip to content

Commit 5a8120c

Browse files
committed
container/run: Fix TestRunAttachTermination
Restore part of the code removed by 966b441 that closed the stream. It's required now because the Run command won't finish before the output stream was processed by the caller. Signed-off-by: Paweł Gronowski <pawel.gronowski@docker.com>
1 parent c27751f commit 5a8120c

1 file changed

Lines changed: 3 additions & 0 deletions

File tree

cli/command/container/run_test.go

Lines changed: 3 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -147,6 +147,7 @@ func TestRunAttachTermination(t *testing.T) {
147147
_ = p.Close()
148148
}()
149149

150+
var conn net.Conn
150151
killCh := make(chan struct{})
151152
attachCh := make(chan struct{})
152153
fakeCLI := test.NewFakeCli(&fakeClient{
@@ -163,6 +164,7 @@ func TestRunAttachTermination(t *testing.T) {
163164
},
164165
containerAttachFunc: func(ctx context.Context, containerID string, options container.AttachOptions) (types.HijackedResponse, error) {
165166
server, client := net.Pipe()
167+
conn = server
166168
t.Cleanup(func() {
167169
_ = server.Close()
168170
})
@@ -202,6 +204,7 @@ func TestRunAttachTermination(t *testing.T) {
202204
}
203205

204206
assert.NilError(t, syscall.Kill(syscall.Getpid(), syscall.SIGTERM))
207+
conn.Close()
205208

206209
select {
207210
case <-killCh:

0 commit comments

Comments
 (0)