1. The functionality of this test is superceded by
`TestAPIIpcModeShareableAndContainer` (see
integration-cli/docker_api_ipcmode_test.go).
2. This test won't work with --default-ipc-mode private.
Signed-off-by: Kir Kolyshkin <kolyshkin@gmail.com>
... | ... |
@@ -2312,48 +2312,6 @@ func (s *DockerSuite) TestRunModeIpcHost(c *check.C) { |
2312 | 2312 |
} |
2313 | 2313 |
} |
2314 | 2314 |
|
2315 |
-func (s *DockerSuite) TestRunModeIpcContainer(c *check.C) { |
|
2316 |
- // Not applicable on Windows as uses Unix-specific capabilities |
|
2317 |
- testRequires(c, SameHostDaemon, DaemonIsLinux) |
|
2318 |
- |
|
2319 |
- out, _ := dockerCmd(c, "run", "-d", "busybox", "sh", "-c", "echo -n test > /dev/shm/test && touch /dev/mqueue/toto && top") |
|
2320 |
- |
|
2321 |
- id := strings.TrimSpace(out) |
|
2322 |
- state := inspectField(c, id, "State.Running") |
|
2323 |
- if state != "true" { |
|
2324 |
- c.Fatal("Container state is 'not running'") |
|
2325 |
- } |
|
2326 |
- pid1 := inspectField(c, id, "State.Pid") |
|
2327 |
- |
|
2328 |
- parentContainerIpc, err := os.Readlink(fmt.Sprintf("/proc/%s/ns/ipc", pid1)) |
|
2329 |
- if err != nil { |
|
2330 |
- c.Fatal(err) |
|
2331 |
- } |
|
2332 |
- |
|
2333 |
- out, _ = dockerCmd(c, "run", fmt.Sprintf("--ipc=container:%s", id), "busybox", "readlink", "/proc/self/ns/ipc") |
|
2334 |
- out = strings.Trim(out, "\n") |
|
2335 |
- if parentContainerIpc != out { |
|
2336 |
- c.Fatalf("IPC different with --ipc=container:%s %s != %s\n", id, parentContainerIpc, out) |
|
2337 |
- } |
|
2338 |
- |
|
2339 |
- catOutput, _ := dockerCmd(c, "run", fmt.Sprintf("--ipc=container:%s", id), "busybox", "cat", "/dev/shm/test") |
|
2340 |
- if catOutput != "test" { |
|
2341 |
- c.Fatalf("Output of /dev/shm/test expected test but found: %s", catOutput) |
|
2342 |
- } |
|
2343 |
- |
|
2344 |
- // check that /dev/mqueue is actually of mqueue type |
|
2345 |
- grepOutput, _ := dockerCmd(c, "run", fmt.Sprintf("--ipc=container:%s", id), "busybox", "grep", "/dev/mqueue", "/proc/mounts") |
|
2346 |
- if !strings.HasPrefix(grepOutput, "mqueue /dev/mqueue mqueue rw") { |
|
2347 |
- c.Fatalf("Output of 'grep /proc/mounts' expected 'mqueue /dev/mqueue mqueue rw' but found: %s", grepOutput) |
|
2348 |
- } |
|
2349 |
- |
|
2350 |
- lsOutput, _ := dockerCmd(c, "run", fmt.Sprintf("--ipc=container:%s", id), "busybox", "ls", "/dev/mqueue") |
|
2351 |
- lsOutput = strings.Trim(lsOutput, "\n") |
|
2352 |
- if lsOutput != "toto" { |
|
2353 |
- c.Fatalf("Output of 'ls /dev/mqueue' expected 'toto' but found: %s", lsOutput) |
|
2354 |
- } |
|
2355 |
-} |
|
2356 |
- |
|
2357 | 2315 |
func (s *DockerSuite) TestRunModeIpcContainerNotExists(c *check.C) { |
2358 | 2316 |
// Not applicable on Windows as uses Unix-specific capabilities |
2359 | 2317 |
testRequires(c, DaemonIsLinux) |