From 5a8120c809db84c14097e685109b330894cdb2b6 Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?Pawe=C5=82=20Gronowski?= Date: Mon, 24 Mar 2025 16:28:05 +0100 Subject: [PATCH] container/run: Fix TestRunAttachTermination MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit 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 --- cli/command/container/run_test.go | 3 +++ 1 file changed, 3 insertions(+) diff --git a/cli/command/container/run_test.go b/cli/command/container/run_test.go index 186d197e49..bf48d3066d 100644 --- a/cli/command/container/run_test.go +++ b/cli/command/container/run_test.go @@ -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: