Skip to content

Commit 03816ad

Browse files
John HowardJohn Howard
John Howard
authored and
John Howard
committed
Windows: Fix RO test cases
Signed-off-by: John Howard <[email protected]>
1 parent 28768a6 commit 03816ad

File tree

2 files changed

+11
-3
lines changed

2 files changed

+11
-3
lines changed

integration-cli/docker_cli_inspect_test.go

+3-1
Original file line numberDiff line numberDiff line change
@@ -239,7 +239,9 @@ func (s *DockerSuite) TestInspectBindMountPoint(c *check.C) {
239239
c.Assert(m.Driver, checker.Equals, "")
240240
c.Assert(m.Source, checker.Equals, prefix+slash+"data")
241241
c.Assert(m.Destination, checker.Equals, prefix+slash+"data")
242-
c.Assert(m.Mode, checker.Equals, "ro"+modifier)
242+
if daemonPlatform != "windows" { // Windows does not set mode
243+
c.Assert(m.Mode, checker.Equals, "ro"+modifier)
244+
}
243245
c.Assert(m.RW, checker.Equals, false)
244246
}
245247

integration-cli/docker_cli_run_test.go

+8-2
Original file line numberDiff line numberDiff line change
@@ -501,20 +501,26 @@ func (s *DockerSuite) TestRunVolumesFromInReadWriteMode(c *check.C) {
501501
}
502502

503503
func (s *DockerSuite) TestVolumesFromGetsProperMode(c *check.C) {
504+
testRequires(c, SameHostDaemon)
504505
prefix, slash := getPrefixAndSlashFromDaemonPlatform()
506+
hostpath := randomTmpDirPath("test", daemonPlatform)
507+
if err := os.MkdirAll(hostpath, 0755); err != nil {
508+
c.Fatalf("Failed to create %s: %q", hostpath, err)
509+
}
510+
defer os.RemoveAll(hostpath)
505511

506512
// TODO Windows: Temporary check - remove once TP5 support is dropped
507513
if daemonPlatform == "windows" && windowsDaemonKV < 14350 {
508514
c.Skip("Needs later Windows build for RO volumes")
509515
}
510-
dockerCmd(c, "run", "--name", "parent", "-v", prefix+slash+"test:"+prefix+slash+"test:ro", "busybox", "true")
516+
dockerCmd(c, "run", "--name", "parent", "-v", hostpath+":"+prefix+slash+"test:ro", "busybox", "true")
511517

512518
// Expect this "rw" mode to be be ignored since the inherited volume is "ro"
513519
if _, _, err := dockerCmdWithError("run", "--volumes-from", "parent:rw", "busybox", "touch", prefix+slash+"test"+slash+"file"); err == nil {
514520
c.Fatal("Expected volumes-from to inherit read-only volume even when passing in `rw`")
515521
}
516522

517-
dockerCmd(c, "run", "--name", "parent2", "-v", prefix+slash+"test:"+prefix+slash+"test:ro", "busybox", "true")
523+
dockerCmd(c, "run", "--name", "parent2", "-v", hostpath+":"+prefix+slash+"test:ro", "busybox", "true")
518524

519525
// Expect this to be read-only since both are "ro"
520526
if _, _, err := dockerCmdWithError("run", "--volumes-from", "parent2:ro", "busybox", "touch", prefix+slash+"test"+slash+"file"); err == nil {

0 commit comments

Comments
 (0)