From 92c72dc5e92a7a2907083dde7a244adcd2175311 Mon Sep 17 00:00:00 2001 From: Kenfe-Mickael Laventure Date: Thu, 31 Mar 2016 12:08:40 -0700 Subject: [PATCH] Add test checking that non fatal signals are correctly handled Signed-off-by: Kenfe-Mickael Laventure --- integration-test/start_test.go | 25 +++++++++++++++++++++++++ 1 file changed, 25 insertions(+) diff --git a/integration-test/start_test.go b/integration-test/start_test.go index 1733444..a8081c5 100644 --- a/integration-test/start_test.go +++ b/integration-test/start_test.go @@ -225,3 +225,28 @@ func (cs *ContainerdSuite) TestStartBusyboxTopSignalSigterm(t *check.C) { } } } + +func (cs *ContainerdSuite) TestStartBusyboxTrapUSR1(t *check.C) { + if err := CreateBusyboxBundle("busybox-trap-usr1", []string{"sh", "-c", "trap 'echo -n booh!' SIGUSR1 ; sleep 100 & wait"}); err != nil { + t.Fatal(err) + } + + containerId := "trap-usr1" + c, err := cs.StartContainer(containerId, "busybox-trap-usr1") + if err != nil { + t.Fatal(err) + } + + if err := cs.SignalContainer(containerId, uint32(syscall.SIGUSR1)); err != nil { + t.Fatal(err) + } + + for { + e := c.GetNextEvent() + if e.Type == "exit" && e.Pid == "init" { + break + } + } + + t.Assert(c.io.stdoutBuffer.String(), checker.Equals, "booh!") +}