MCPcopy
hub / github.com/docker/compose / TestPreStopHookInError

Function TestPreStopHookInError

pkg/e2e/hooks_test.go:78–92  ·  pkg/e2e/hooks_test.go::TestPreStopHookInError
(t *testing.T)

Source from the content-addressed store, hash-verified

76}
77
78func TestPreStopHookInError(t *testing.T) {
79 c := NewParallelCLI(t)
80 const projectName = "hooks-pre-stop-failure"
81
82 t.Cleanup(func() {
83 c.RunDockerComposeCmd(t, "-f", "fixtures/hooks/prestop/compose-success.yaml", "--project-name", projectName, "down", "-v", "--remove-orphans", "-t", "0")
84 })
85
86 res := c.RunDockerComposeCmdNoCheck(t, "-f", "fixtures/hooks/prestop/compose-error.yaml", "--project-name", projectName, "up", "-d")
87 res.Assert(t, icmd.Expected{ExitCode: 0})
88
89 res = c.RunDockerComposeCmdNoCheck(t, "-f", "fixtures/hooks/prestop/compose-error.yaml", "--project-name", projectName, "down", "-v", "--remove-orphans", "-t", "0")
90 res.Assert(t, icmd.Expected{ExitCode: 1})
91 assert.Assert(t, strings.Contains(res.Combined(), "sample hook exited with status 127"))
92}
93
94func TestPreStopHookSuccessWithPreviousStop(t *testing.T) {
95 c := NewParallelCLI(t)

Callers

nothing calls this directly

Calls 3

NewParallelCLIFunction · 0.85
RunDockerComposeCmdMethod · 0.80

Tested by

no test coverage detected