(t *testing.T)
| 280 | } |
| 281 | |
| 282 | func TestRunWithInit(t *testing.T) { |
| 283 | t.Parallel() |
| 284 | testutil.DockerIncompatible(t) |
| 285 | testutil.RequireExecutable(t, "tini-custom") |
| 286 | base := testutil.NewBase(t) |
| 287 | |
| 288 | container := testutil.Identifier(t) |
| 289 | base.Cmd("run", "-d", "--name", container, testutil.AlpineImage, "sleep", nerdtest.Infinity).AssertOK() |
| 290 | defer base.Cmd("rm", "-f", container).Run() |
| 291 | |
| 292 | base.Cmd("stop", "--time=3", container).AssertOK() |
| 293 | // Unable to handle TERM signal, be killed when timeout |
| 294 | assert.Equal(t, base.InspectContainer(container).State.ExitCode, 137) |
| 295 | |
| 296 | // Test with --init-path |
| 297 | container1 := container + "-1" |
| 298 | base.Cmd("run", "-d", "--name", container1, "--init-binary", "tini-custom", |
| 299 | testutil.AlpineImage, "sleep", nerdtest.Infinity).AssertOK() |
| 300 | defer base.Cmd("rm", "-f", container1).Run() |
| 301 | |
| 302 | base.Cmd("stop", "--time=3", container1).AssertOK() |
| 303 | assert.Equal(t, base.InspectContainer(container1).State.ExitCode, 143) |
| 304 | |
| 305 | // Test with --init |
| 306 | container2 := container + "-2" |
| 307 | base.Cmd("run", "-d", "--name", container2, "--init", |
| 308 | testutil.AlpineImage, "sleep", nerdtest.Infinity).AssertOK() |
| 309 | defer base.Cmd("rm", "-f", container2).Run() |
| 310 | |
| 311 | base.Cmd("stop", "--time=3", container2).AssertOK() |
| 312 | assert.Equal(t, base.InspectContainer(container2).State.ExitCode, 143) |
| 313 | } |
| 314 | |
| 315 | func TestRunTTY(t *testing.T) { |
| 316 | const sttyPartialOutput = "speed 38400 baud" |
nothing calls this directly
no test coverage detected
searching dependent graphs…