Merge pull request #28823 from AkihiroSuda/ensure-dev-pts-readonly

add a test for ensuring the behavior of read-only /dev/shm
This commit is contained in:
Brian Goff 2016-12-06 08:39:43 -05:00 committed by GitHub
commit 11702c66cf
1 changed files with 13 additions and 0 deletions

View File

@ -4647,3 +4647,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")
}