|
@@ -2312,48 +2312,6 @@ func (s *DockerSuite) TestRunModeIpcHost(c *check.C) {
|
|
|
}
|
|
|
}
|
|
|
|
|
|
-func (s *DockerSuite) TestRunModeIpcContainer(c *check.C) {
|
|
|
- // Not applicable on Windows as uses Unix-specific capabilities
|
|
|
- testRequires(c, SameHostDaemon, DaemonIsLinux)
|
|
|
-
|
|
|
- out, _ := dockerCmd(c, "run", "-d", "busybox", "sh", "-c", "echo -n test > /dev/shm/test && touch /dev/mqueue/toto && top")
|
|
|
-
|
|
|
- id := strings.TrimSpace(out)
|
|
|
- state := inspectField(c, id, "State.Running")
|
|
|
- if state != "true" {
|
|
|
- c.Fatal("Container state is 'not running'")
|
|
|
- }
|
|
|
- pid1 := inspectField(c, id, "State.Pid")
|
|
|
-
|
|
|
- parentContainerIpc, err := os.Readlink(fmt.Sprintf("/proc/%s/ns/ipc", pid1))
|
|
|
- if err != nil {
|
|
|
- c.Fatal(err)
|
|
|
- }
|
|
|
-
|
|
|
- out, _ = dockerCmd(c, "run", fmt.Sprintf("--ipc=container:%s", id), "busybox", "readlink", "/proc/self/ns/ipc")
|
|
|
- out = strings.Trim(out, "\n")
|
|
|
- if parentContainerIpc != out {
|
|
|
- c.Fatalf("IPC different with --ipc=container:%s %s != %s\n", id, parentContainerIpc, out)
|
|
|
- }
|
|
|
-
|
|
|
- catOutput, _ := dockerCmd(c, "run", fmt.Sprintf("--ipc=container:%s", id), "busybox", "cat", "/dev/shm/test")
|
|
|
- if catOutput != "test" {
|
|
|
- c.Fatalf("Output of /dev/shm/test expected test but found: %s", catOutput)
|
|
|
- }
|
|
|
-
|
|
|
- // check that /dev/mqueue is actually of mqueue type
|
|
|
- grepOutput, _ := dockerCmd(c, "run", fmt.Sprintf("--ipc=container:%s", id), "busybox", "grep", "/dev/mqueue", "/proc/mounts")
|
|
|
- if !strings.HasPrefix(grepOutput, "mqueue /dev/mqueue mqueue rw") {
|
|
|
- c.Fatalf("Output of 'grep /proc/mounts' expected 'mqueue /dev/mqueue mqueue rw' but found: %s", grepOutput)
|
|
|
- }
|
|
|
-
|
|
|
- lsOutput, _ := dockerCmd(c, "run", fmt.Sprintf("--ipc=container:%s", id), "busybox", "ls", "/dev/mqueue")
|
|
|
- lsOutput = strings.Trim(lsOutput, "\n")
|
|
|
- if lsOutput != "toto" {
|
|
|
- c.Fatalf("Output of 'ls /dev/mqueue' expected 'toto' but found: %s", lsOutput)
|
|
|
- }
|
|
|
-}
|
|
|
-
|
|
|
func (s *DockerSuite) TestRunModeIpcContainerNotExists(c *check.C) {
|
|
|
// Not applicable on Windows as uses Unix-specific capabilities
|
|
|
testRequires(c, DaemonIsLinux)
|