TestContainerWithConflictingNoneNetwork: Extend Windows timeout

Increase stop timeout on Windows and split container and CLI exit waits.

Wait for the container to reach `exited` before timing how long the
`docker run -i` process takes to exit with stdin still open.

This keeps the regression check focused on the post-exit CLI behavior
instead of combining it with container startup time. Use a unique
container name to avoid collisions with leftovers from previous runs.

Signed-off-by: Paweł Gronowski <pawel.gronowski@docker.com>
This commit is contained in:
Paweł Gronowski
2026-06-17 21:15:23 +02:00
parent 908a35a91b
commit a81aa78ceb

View File

@@ -3501,7 +3501,9 @@ func (s *DockerCLIRunSuite) TestContainerWithConflictingNoneNetwork(c *testing.T
// #11957 - stdin with no tty does not exit if stdin is not closed even though container exited
func (s *DockerCLIRunSuite) TestRunStdinBlockedAfterContainerExit(c *testing.T) {
cmd := exec.Command(dockerBinary, "run", "-i", "--name=test", "busybox", "true")
name := "test-stdin-blocked-" + stringid.GenerateRandomID()
cmd := exec.Command(dockerBinary, "run", "-i", "--name", name, "busybox", "true")
in, err := cmd.StdinPipe()
assert.NilError(c, err)
defer in.Close()
@@ -3509,14 +3511,23 @@ func (s *DockerCLIRunSuite) TestRunStdinBlockedAfterContainerExit(c *testing.T)
cmd.Stdout = stdout
cmd.Stderr = stdout
assert.NilError(c, cmd.Start())
c.Cleanup(func() {
dockerCmdWithError("rm", "-f", name)
})
waitChan := make(chan error, 1)
exitTimeout := 10 * time.Second
if DaemonIsWindows() {
exitTimeout = 60 * time.Second
}
cli.WaitExited(c, name, exitTimeout)
cmdExited := make(chan error, 1)
go func() {
waitChan <- cmd.Wait()
cmdExited <- cmd.Wait()
}()
select {
case err := <-waitChan:
case err := <-cmdExited:
assert.Assert(c, err == nil, stdout.String())
case <-time.After(30 * time.Second):
c.Fatal("timeout waiting for command to exit")