container/run: Fix TestRunAttachTermination

Restore part of the code removed by 966b44183f525a8cca6caeaff2dc5b3f156fd06e
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>
This commit is contained in:
Paweł Gronowski 2025-03-24 16:28:05 +01:00
parent c27751fcfe
commit 5a8120c809
No known key found for this signature in database
GPG Key ID: B85EFCFE26DEF92A

View File

@ -147,6 +147,7 @@ func TestRunAttachTermination(t *testing.T) {
_ = p.Close()
}()
var conn net.Conn
killCh := make(chan struct{})
attachCh := make(chan struct{})
fakeCLI := test.NewFakeCli(&fakeClient{
@ -163,6 +164,7 @@ func TestRunAttachTermination(t *testing.T) {
},
containerAttachFunc: func(ctx context.Context, containerID string, options container.AttachOptions) (types.HijackedResponse, error) {
server, client := net.Pipe()
conn = server
t.Cleanup(func() {
_ = server.Close()
})
@ -202,6 +204,7 @@ func TestRunAttachTermination(t *testing.T) {
}
assert.NilError(t, syscall.Kill(syscall.Getpid(), syscall.SIGTERM))
conn.Close()
select {
case <-killCh: