|
@@ -47,7 +47,7 @@ func (s *DockerSuite) TestKillDifferentUserContainer(c *check.C) {
|
|
|
|
|
|
// regression test about correct signal parsing see #13665
|
|
|
func (s *DockerSuite) TestKillWithSignal(c *check.C) {
|
|
|
- // Cannot port to Windows - does not support signals in the same was a Linux does
|
|
|
+ // Cannot port to Windows - does not support signals in the same way Linux does
|
|
|
testRequires(c, DaemonIsLinux)
|
|
|
out, _ := dockerCmd(c, "run", "-d", "busybox", "top")
|
|
|
cid := strings.TrimSpace(out)
|
|
@@ -60,6 +60,36 @@ func (s *DockerSuite) TestKillWithSignal(c *check.C) {
|
|
|
c.Assert(running, checker.Equals, "true", check.Commentf("Container should be in running state after SIGWINCH"))
|
|
|
}
|
|
|
|
|
|
+func (s *DockerSuite) TestKillWithStopSignalWithSameSignalShouldDisableRestartPolicy(c *check.C) {
|
|
|
+ // Cannot port to Windows - does not support signals int the same way as Linux does
|
|
|
+ testRequires(c, DaemonIsLinux)
|
|
|
+ out, _ := dockerCmd(c, "run", "-d", "--stop-signal=TERM", "busybox", "top")
|
|
|
+ cid := strings.TrimSpace(out)
|
|
|
+ c.Assert(waitRun(cid), check.IsNil)
|
|
|
+
|
|
|
+ // Let's docker send a CONT signal to the container
|
|
|
+ dockerCmd(c, "kill", "-s", "TERM", cid)
|
|
|
+
|
|
|
+ out, _ = dockerCmd(c, "ps", "-q")
|
|
|
+ c.Assert(out, checker.Not(checker.Contains), cid, check.Commentf("killed container is still running"))
|
|
|
+}
|
|
|
+
|
|
|
+func (s *DockerSuite) TestKillWithStopSignalWithDifferentSignalShouldKeepRestartPolicy(c *check.C) {
|
|
|
+ // Cannot port to Windows - does not support signals int the same way as Linux does
|
|
|
+ testRequires(c, DaemonIsLinux)
|
|
|
+ out, _ := dockerCmd(c, "run", "-d", "--stop-signal=CONT", "busybox", "top")
|
|
|
+ cid := strings.TrimSpace(out)
|
|
|
+ c.Assert(waitRun(cid), check.IsNil)
|
|
|
+
|
|
|
+ // Let's docker send a TERM signal to the container
|
|
|
+ // It will kill the process, but not disable the restart policy
|
|
|
+ dockerCmd(c, "kill", "-s", "TERM", cid)
|
|
|
+
|
|
|
+ // Restart policy should still be in place, so it should be still running
|
|
|
+ c.Assert(waitRun(cid), check.IsNil)
|
|
|
+}
|
|
|
+
|
|
|
+// FIXME(vdemeester) should be a unit test
|
|
|
func (s *DockerSuite) TestKillWithInvalidSignal(c *check.C) {
|
|
|
out, _ := runSleepingContainer(c, "-d")
|
|
|
cid := strings.TrimSpace(out)
|