Add E2E tests for `up --exit-code-from`

Signed-off-by: Laura Brehm <laurabrehm@hey.com>
This commit is contained in:
Laura Brehm 2022-08-27 17:44:08 +02:00
parent 23deefd20c
commit 0d2beddf20
No known key found for this signature in database
GPG Key ID: 526E3FC49260D47A
2 changed files with 22 additions and 0 deletions

View File

@ -22,6 +22,7 @@ import (
"time"
"gotest.tools/v3/assert"
"gotest.tools/v3/icmd"
)
func TestUpWait(t *testing.T) {
@ -45,3 +46,13 @@ func TestUpWait(t *testing.T) {
c.RunDockerComposeCmd(t, "--project-name", projectName, "down")
}
func TestUpExitCodeFrom(t *testing.T) {
c := NewParallelCLI(t)
const projectName = "e2e-exit-code-from"
res := c.RunDockerComposeCmdNoCheck(t, "-f", "fixtures/start-fail/start-depends_on-long-lived.yaml", "--project-name", projectName, "up", "--exit-code-from=test")
res.Assert(t, icmd.Expected{ExitCode: 137})
c.RunDockerComposeCmd(t, "--project-name", projectName, "down", "--remove-orphans")
}

View File

@ -0,0 +1,11 @@
services:
safe:
image: 'alpine'
command: ['/bin/sh', '-c', 'sleep infinity'] # never exiting
failure:
image: 'alpine'
command: ['/bin/sh', '-c', 'sleep 2 ; echo "exiting" ; exit 42']
test:
image: 'alpine'
command: ['/bin/sh', '-c', 'sleep 99999 ; echo "tests are OK"'] # very long job
depends_on: [safe]