mirror of
https://github.com/moby/moby.git
synced 2025-07-30 18:23:29 +03:00
TestDaemonRestartIpcMode: modernize
Move the test case from integration-cli to integration. The test logic itself has not changed, except these two things: * the new test sets default-ipc-mode via command line rather than via daemon.json (less code); * the new test uses current API version. Signed-off-by: Kir Kolyshkin <kolyshkin@gmail.com>
This commit is contained in:
@ -2896,47 +2896,6 @@ func (s *DockerDaemonSuite) TestDaemonStartWithIpcModes(c *check.C) {
|
||||
}
|
||||
}
|
||||
|
||||
// TestDaemonRestartIpcMode makes sure a container keeps its ipc mode
|
||||
// (derived from daemon default) even after the daemon is restarted
|
||||
// with a different default ipc mode.
|
||||
func (s *DockerDaemonSuite) TestDaemonRestartIpcMode(c *check.C) {
|
||||
f, err := ioutil.TempFile("", "test-daemon-ipc-config-restart")
|
||||
c.Assert(err, checker.IsNil)
|
||||
file := f.Name()
|
||||
defer os.Remove(file)
|
||||
c.Assert(f.Close(), checker.IsNil)
|
||||
|
||||
config := []byte(`{"default-ipc-mode": "private"}`)
|
||||
c.Assert(ioutil.WriteFile(file, config, 0644), checker.IsNil)
|
||||
s.d.StartWithBusybox(c, "--config-file", file)
|
||||
|
||||
// check the container is created with private ipc mode as per daemon default
|
||||
name := "ipc1"
|
||||
_, err = s.d.Cmd("run", "-d", "--name", name, "--restart=always", "busybox", "top")
|
||||
c.Assert(err, checker.IsNil)
|
||||
m, err := s.d.InspectField(name, ".HostConfig.IpcMode")
|
||||
c.Assert(err, check.IsNil)
|
||||
c.Assert(m, checker.Equals, "private")
|
||||
|
||||
// restart the daemon with shareable default ipc mode
|
||||
config = []byte(`{"default-ipc-mode": "shareable"}`)
|
||||
c.Assert(ioutil.WriteFile(file, config, 0644), checker.IsNil)
|
||||
s.d.Restart(c, "--config-file", file)
|
||||
|
||||
// check the container is still having private ipc mode
|
||||
m, err = s.d.InspectField(name, ".HostConfig.IpcMode")
|
||||
c.Assert(err, check.IsNil)
|
||||
c.Assert(m, checker.Equals, "private")
|
||||
|
||||
// check a new container is created with shareable ipc mode as per new daemon default
|
||||
name = "ipc2"
|
||||
_, err = s.d.Cmd("run", "-d", "--name", name, "busybox", "top")
|
||||
c.Assert(err, checker.IsNil)
|
||||
m, err = s.d.InspectField(name, ".HostConfig.IpcMode")
|
||||
c.Assert(err, check.IsNil)
|
||||
c.Assert(m, checker.Equals, "shareable")
|
||||
}
|
||||
|
||||
// TestFailedPluginRemove makes sure that a failed plugin remove does not block
|
||||
// the daemon from starting
|
||||
func (s *DockerDaemonSuite) TestFailedPluginRemove(c *check.C) {
|
||||
|
Reference in New Issue
Block a user