mirror of
https://github.com/moby/moby.git
synced 2022-11-09 12:21:53 -05:00
add a test for ensuring the behavior of read-only /dev/shm
The test ensures that `docker run --read-only -v /var/empty:/dev/shm:ro` makes /dev/shm read-only Signed-off-by: Akihiro Suda <suda.akihiro@lab.ntt.co.jp>
This commit is contained in:
parent
b8e3a28d65
commit
46ade6acb5
1 changed files with 13 additions and 0 deletions
|
@ -4879,3 +4879,16 @@ func (s *delayedReader) Read([]byte) (int, error) {
|
|||
time.Sleep(500 * time.Millisecond)
|
||||
return 0, io.EOF
|
||||
}
|
||||
|
||||
// #28823 (originally #28639)
|
||||
func (s *DockerSuite) TestRunMountReadOnlyDevShm(c *check.C) {
|
||||
testRequires(c, SameHostDaemon, DaemonIsLinux)
|
||||
emptyDir, err := ioutil.TempDir("", "test-read-only-dev-shm")
|
||||
c.Assert(err, check.IsNil)
|
||||
defer os.RemoveAll(emptyDir)
|
||||
out, _, err := dockerCmdWithError("run", "--rm", "--read-only",
|
||||
"-v", fmt.Sprintf("%s:/dev/shm:ro", emptyDir),
|
||||
"busybox", "touch", "/dev/shm/foo")
|
||||
c.Assert(err, checker.NotNil, check.Commentf(out))
|
||||
c.Assert(out, checker.Contains, "Read-only file system")
|
||||
}
|
||||
|
|
Loading…
Add table
Reference in a new issue