mirror of
https://github.com/docker/compose.git
synced 2025-07-26 23:24:05 +02:00
make sure the post_start hooks fails
before we were assuming the container will be close before the post_start will be executed Signed-off-by: Guillaume Lours <705411+glours@users.noreply.github.com>
This commit is contained in:
parent
3553aa26a6
commit
f613379373
@ -1,6 +1,6 @@
|
|||||||
services:
|
services:
|
||||||
|
|
||||||
test:
|
test:
|
||||||
image: alpine
|
image: nginx
|
||||||
post_start:
|
post_start:
|
||||||
- command: sh -c 'echo env'
|
- command: sh -c 'command in error'
|
||||||
|
@ -33,8 +33,7 @@ func TestPostStartHookInError(t *testing.T) {
|
|||||||
|
|
||||||
res := c.RunDockerComposeCmdNoCheck(t, "-f", "fixtures/hooks/poststart/compose-error.yaml", "--project-name", projectName, "up", "-d")
|
res := c.RunDockerComposeCmdNoCheck(t, "-f", "fixtures/hooks/poststart/compose-error.yaml", "--project-name", projectName, "up", "-d")
|
||||||
res.Assert(t, icmd.Expected{ExitCode: 1})
|
res.Assert(t, icmd.Expected{ExitCode: 1})
|
||||||
assert.Assert(t, strings.Contains(res.Combined(), "Error response from daemon: container"), res.Combined())
|
assert.Assert(t, strings.Contains(res.Combined(), "test hook exited with status 127"), res.Combined())
|
||||||
assert.Assert(t, strings.Contains(res.Combined(), "is not running"), res.Combined())
|
|
||||||
}
|
}
|
||||||
|
|
||||||
func TestPostStartHookSuccess(t *testing.T) {
|
func TestPostStartHookSuccess(t *testing.T) {
|
||||||
|
Loading…
x
Reference in New Issue
Block a user