From dd654ecca04082541f953062f8008fa3e78d9ee7 Mon Sep 17 00:00:00 2001 From: Maksym Pavlenko Date: Tue, 21 Jul 2026 21:39:27 -0700 Subject: [PATCH] Fix does not contain \x00 on windows Signed-off-by: Maksym Pavlenko --- integration/client/container_test.go | 27 +++++++++------------------ 1 file changed, 9 insertions(+), 18 deletions(-) diff --git a/integration/client/container_test.go b/integration/client/container_test.go index e5a9482930..b8ec0cb0cc 100644 --- a/integration/client/container_test.go +++ b/integration/client/container_test.go @@ -2773,27 +2773,18 @@ func TestContainerPTY(t *testing.T) { <-statusC + // Wait for all IO copy operations to complete before inspecting buf. + // Otherwise there is a race between the IO copy goroutine writing to buf + // and the read below, which is flaky on Windows named pipes. Wait must be + // called before Delete, which cancels the IO. + task.IO().Wait() + if _, err := task.Delete(ctx); err != nil { t.Fatal(err) } - tries := 1 - if runtime.GOOS == "windows" { - // TODO: Fix flakiness on Window by checking for race in writing to buffer - tries += 2 - } - - for { - out := buf.String() - if strings.ContainsAny(fmt.Sprintf("%#q", out), `\x00`) { - break - - } - tries-- - if tries == 0 { - t.Fatal(`expected \x00 in output`) - } - t.Logf("output %#q does not contain \\x00, trying again", out) - time.Sleep(time.Millisecond) + out := buf.String() + if !strings.ContainsAny(fmt.Sprintf("%#q", out), `\x00`) { + t.Fatalf(`expected \x00 in output, got %#q`, out) } }