mirror of
https://github.com/moby/moby.git
synced 2022-11-09 12:21:53 -05:00
Merge pull request #23700 from Microsoft/jjh/fixrotestcases
Windows: Fix RO test cases
This commit is contained in:
commit
7b2b4eb40c
2 changed files with 11 additions and 3 deletions
|
@ -239,7 +239,9 @@ func (s *DockerSuite) TestInspectBindMountPoint(c *check.C) {
|
|||
c.Assert(m.Driver, checker.Equals, "")
|
||||
c.Assert(m.Source, checker.Equals, prefix+slash+"data")
|
||||
c.Assert(m.Destination, checker.Equals, prefix+slash+"data")
|
||||
c.Assert(m.Mode, checker.Equals, "ro"+modifier)
|
||||
if daemonPlatform != "windows" { // Windows does not set mode
|
||||
c.Assert(m.Mode, checker.Equals, "ro"+modifier)
|
||||
}
|
||||
c.Assert(m.RW, checker.Equals, false)
|
||||
}
|
||||
|
||||
|
|
|
@ -501,20 +501,26 @@ func (s *DockerSuite) TestRunVolumesFromInReadWriteMode(c *check.C) {
|
|||
}
|
||||
|
||||
func (s *DockerSuite) TestVolumesFromGetsProperMode(c *check.C) {
|
||||
testRequires(c, SameHostDaemon)
|
||||
prefix, slash := getPrefixAndSlashFromDaemonPlatform()
|
||||
hostpath := randomTmpDirPath("test", daemonPlatform)
|
||||
if err := os.MkdirAll(hostpath, 0755); err != nil {
|
||||
c.Fatalf("Failed to create %s: %q", hostpath, err)
|
||||
}
|
||||
defer os.RemoveAll(hostpath)
|
||||
|
||||
// TODO Windows: Temporary check - remove once TP5 support is dropped
|
||||
if daemonPlatform == "windows" && windowsDaemonKV < 14350 {
|
||||
c.Skip("Needs later Windows build for RO volumes")
|
||||
}
|
||||
dockerCmd(c, "run", "--name", "parent", "-v", prefix+slash+"test:"+prefix+slash+"test:ro", "busybox", "true")
|
||||
dockerCmd(c, "run", "--name", "parent", "-v", hostpath+":"+prefix+slash+"test:ro", "busybox", "true")
|
||||
|
||||
// Expect this "rw" mode to be be ignored since the inherited volume is "ro"
|
||||
if _, _, err := dockerCmdWithError("run", "--volumes-from", "parent:rw", "busybox", "touch", prefix+slash+"test"+slash+"file"); err == nil {
|
||||
c.Fatal("Expected volumes-from to inherit read-only volume even when passing in `rw`")
|
||||
}
|
||||
|
||||
dockerCmd(c, "run", "--name", "parent2", "-v", prefix+slash+"test:"+prefix+slash+"test:ro", "busybox", "true")
|
||||
dockerCmd(c, "run", "--name", "parent2", "-v", hostpath+":"+prefix+slash+"test:ro", "busybox", "true")
|
||||
|
||||
// Expect this to be read-only since both are "ro"
|
||||
if _, _, err := dockerCmdWithError("run", "--volumes-from", "parent2:ro", "busybox", "touch", prefix+slash+"test"+slash+"file"); err == nil {
|
||||
|
|
Loading…
Reference in a new issue