(t *testing.T)
| 137 | } |
| 138 | |
| 139 | func 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 | |
| 158 | func TestPreStartHookBuildInheritance(t *testing.T) { |
| 159 | c := NewParallelCLI(t) |
nothing calls this directly
no test coverage detected