From f6133793736885985b7c5d2b4f3aab9fee855bab Mon Sep 17 00:00:00 2001 From: Guillaume Lours <705411+glours@users.noreply.github.com> Date: Mon, 30 Jun 2025 12:20:50 +0200 Subject: [PATCH] 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> --- pkg/e2e/fixtures/hooks/poststart/compose-error.yaml | 4 ++-- pkg/e2e/hooks_test.go | 3 +-- 2 files changed, 3 insertions(+), 4 deletions(-) diff --git a/pkg/e2e/fixtures/hooks/poststart/compose-error.yaml b/pkg/e2e/fixtures/hooks/poststart/compose-error.yaml index eaee936b8..2d5bf5c44 100644 --- a/pkg/e2e/fixtures/hooks/poststart/compose-error.yaml +++ b/pkg/e2e/fixtures/hooks/poststart/compose-error.yaml @@ -1,6 +1,6 @@ services: test: - image: alpine + image: nginx post_start: - - command: sh -c 'echo env' + - command: sh -c 'command in error' diff --git a/pkg/e2e/hooks_test.go b/pkg/e2e/hooks_test.go index df60a207b..b77500c6b 100644 --- a/pkg/e2e/hooks_test.go +++ b/pkg/e2e/hooks_test.go @@ -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.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(), "is not running"), res.Combined()) + assert.Assert(t, strings.Contains(res.Combined(), "test hook exited with status 127"), res.Combined()) } func TestPostStartHookSuccess(t *testing.T) {