1
0
Fork 0
mirror of https://github.com/moby/moby.git synced 2022-11-09 12:21:53 -05:00

test: daemon restart with containers running with restart always policy

manually stopped

If a container is running with a restart policy of always and it's
manually stopped, then on daemon restart it will be running.

Signed-off-by: Antonio Murdaca <runcom@linux.com>
This commit is contained in:
Antonio Murdaca 2015-08-01 14:52:00 +02:00
parent 8f2dca5386
commit af59c80b4a

View file

@ -1527,3 +1527,26 @@ func teardownV6() error {
}
return nil
}
func (s *DockerDaemonSuite) TestDaemonRestartWithContainerWithRestartPolicyAlways(c *check.C) {
c.Assert(s.d.StartWithBusybox(), check.IsNil)
out, err := s.d.Cmd("run", "-d", "--restart", "always", "busybox", "top")
c.Assert(err, check.IsNil)
id := strings.TrimSpace(out)
_, err = s.d.Cmd("stop", id)
c.Assert(err, check.IsNil)
_, err = s.d.Cmd("wait", id)
c.Assert(err, check.IsNil)
out, err = s.d.Cmd("ps", "-q")
c.Assert(err, check.IsNil)
c.Assert(out, check.Equals, "")
c.Assert(s.d.Restart(), check.IsNil)
out, err = s.d.Cmd("ps", "-q")
c.Assert(err, check.IsNil)
c.Assert(strings.TrimSpace(out), check.Equals, id[:12])
}