Files
moby/integration-cli
Sebastiaan van Stijn fe1a505cbf simplify some commit tests, and work around change in CLI behavior
These tests were failing because the "docker run" did not print the
ID of the container, and instead detached immediately without printing;

```
=== Failed
=== FAIL: amd64.integration-cli TestDockerCLICommitSuite/TestCommitAfterContainerIsDone (0.27s)
    docker_cli_commit_test.go:32: assertion failed:
        Command:  /usr/local/cli-integration/docker wait
        ExitCode: 1
        Error:    exit status 1
        Stdout:
        Stderr:   invalid container name or ID: value is empty

        Failures:
        ExitCode was 1 expected 0
        Expected no error
    --- FAIL: TestDockerCLICommitSuite/TestCommitAfterContainerIsDone (0.27s)

=== FAIL: amd64.integration-cli TestDockerCLICommitSuite/TestCommitWithoutPause (0.20s)
    docker_cli_commit_test.go:47: assertion failed:
        Command:  /usr/local/cli-integration/docker wait
        ExitCode: 1
        Error:    exit status 1
        Stdout:
        Stderr:   invalid container name or ID: value is empty

        Failures:
        ExitCode was 1 expected 0
        Expected no error
    --- FAIL: TestDockerCLICommitSuite/TestCommitWithoutPause (0.20s)
```

What happens is that it starts a container with only `stdin` attached, but
no `stdout`, and the behavior changed between versions of the CLI, which
may be either a bugfix or a regression;

docker 28 cli doesn't stay attached:

```bash
Status: Downloaded newer image for docker:28-cli
/ # docker run -i -a stdin busybox echo foo
/ #
```

docker 27 cli stays attached, but has the "three strikes, you're out" handling:

```bash
docker run -it --rm -v /var/run/docker.sock:/var/run/docker.sock docker:27-cli sh
Status: Downloaded newer image for docker:27-cli
/ # docker run -i -a stdin busybox echo foo
9dbb29080a72225593885bc4880d8f4f22f36803100179f9725468bda1d52b4f

^C^C^C
got 3 SIGTERM/SIGINTs, forcefully exiting
/ # ^C
```

docker 26 cli (and older) don't forward the signal to the container, and detach-keys don't work (or in this case, are handled by the CLI container)?:

```bash
docker run -it --rm -v /var/run/docker.sock:/var/run/docker.sock docker:26-cli sh
Status: Downloaded newer image for docker:26-cli
/ # docker run -i -a stdin busybox echo foo
21963ce1b9a7bb7eccef3618693b09a106fb29084b484e31c69cd4a26ee44777
^C^C^C^C^C^C^C^C^C^C^C^C^C^C^C^C^C^C^C^C^C^C^C^C^C^C^C^C^C

<CTRL>p,q
```

As these tests were not testing that part, I simplified the tests, but
we should probably look into the change of behavior to see if it was
intentional (and if it was correct).

Signed-off-by: Sebastiaan van Stijn <github@gone.nl>
2025-11-10 12:40:14 +01:00
..
2025-09-08 10:08:30 +02:00
2025-09-08 10:08:30 +02:00
2025-06-05 21:42:05 +00:00
2025-06-05 21:42:05 +00:00