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

Function TestPreStartHookInError

pkg/e2e/hooks_test.go:139–156  ·  view source on GitHub ↗
(t *testing.T)

Source from the content-addressed store, hash-verified

137}
138
139func TestPreStartHookInError(t *testing.T) {
140 c := NewParallelCLI(t)
141 const projectName = "hooks-pre-start-failure"
142
143 t.Cleanup(func() {
144 c.RunDockerComposeCmd(t, "-f", "fixtures/pre_start/compose-error.yaml", "--project-name", projectName, "down", "-v", "--remove-orphans", "-t", "0")
145 })
146
147 res := c.RunDockerComposeCmdNoCheck(t, "-f", "fixtures/pre_start/compose-error.yaml", "--project-name", projectName, "up", "-d")
148 res.Assert(t, icmd.Expected{ExitCode: 1})
149 assert.Assert(t, strings.Contains(res.Combined(), "pre_start"), res.Combined())
150 assert.Assert(t, strings.Contains(res.Combined(), "17"), res.Combined())
151
152 // The service container should exist but not be running.
153 ps := c.RunDockerCmd(t, "ps", "-a", "--filter", "label=com.docker.compose.project="+projectName, "--format", "{{.Names}} {{.State}}")
154 assert.Assert(t, strings.Contains(ps.Combined(), "sample"), ps.Combined())
155 assert.Assert(t, !strings.Contains(ps.Combined(), "running"), ps.Combined())
156}
157
158func TestPreStartHookBuildInheritance(t *testing.T) {
159 c := NewParallelCLI(t)

Callers

nothing calls this directly

Calls 4

NewParallelCLIFunction · 0.85
RunDockerComposeCmdMethod · 0.80
RunDockerCmdMethod · 0.80

Tested by

no test coverage detected