mirror of
https://github.com/moby/moby.git
synced 2022-11-09 12:21:53 -05:00
IT for ungraceful daemon restart with multiple host-mode containers
Signed-off-by: Madhu Venugopal <madhu@docker.com>
This commit is contained in:
parent
beeec6d103
commit
b323e3df8b
1 changed files with 26 additions and 0 deletions
|
@ -738,3 +738,29 @@ func (s *DockerNetworkSuite) TestDockerNetworkRunNetByID(c *check.C) {
|
|||
out, _ := dockerCmd(c, "network", "create", "one")
|
||||
dockerCmd(c, "run", "-d", "--net", strings.TrimSpace(out), "busybox", "top")
|
||||
}
|
||||
|
||||
func (s *DockerNetworkSuite) TestDockerNetworkHostModeUngracefulDaemonRestart(c *check.C) {
|
||||
testRequires(c, DaemonIsLinux, NotUserNamespace)
|
||||
s.d.Start()
|
||||
|
||||
// Run a few containers on host network
|
||||
for i := 0; i < 10; i++ {
|
||||
cName := fmt.Sprintf("hostc-%d", i)
|
||||
out, err := s.d.Cmd("run", "-d", "--name", cName, "--net=host", "--restart=always", "busybox", "top")
|
||||
c.Assert(err, checker.IsNil, check.Commentf(out))
|
||||
}
|
||||
|
||||
// Kill daemon ungracefully and restart
|
||||
if err := s.d.cmd.Process.Kill(); err != nil {
|
||||
c.Fatal(err)
|
||||
}
|
||||
s.d.Restart()
|
||||
|
||||
// make sure all the containers are up and running
|
||||
for i := 0; i < 10; i++ {
|
||||
cName := fmt.Sprintf("hostc-%d", i)
|
||||
runningOut, err := s.d.Cmd("inspect", "--format='{{.State.Running}}'", cName)
|
||||
c.Assert(err, checker.IsNil)
|
||||
c.Assert(strings.TrimSpace(runningOut), checker.Equals, "true")
|
||||
}
|
||||
}
|
||||
|
|
Loading…
Add table
Reference in a new issue