Browse code

Windows: Fix RO test cases

Signed-off-by: John Howard <jhoward@microsoft.com>

John Howard authored on 2016/06/18 07:46:45
Showing 2 changed files
... ...
@@ -239,7 +239,9 @@ func (s *DockerSuite) TestInspectBindMountPoint(c *check.C) {
239 239
 	c.Assert(m.Driver, checker.Equals, "")
240 240
 	c.Assert(m.Source, checker.Equals, prefix+slash+"data")
241 241
 	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
+	}
243 245
 	c.Assert(m.RW, checker.Equals, false)
244 246
 }
245 247
 
... ...
@@ -501,20 +501,26 @@ func (s *DockerSuite) TestRunVolumesFromInReadWriteMode(c *check.C) {
501 501
 }
502 502
 
503 503
 func (s *DockerSuite) TestVolumesFromGetsProperMode(c *check.C) {
504
+	testRequires(c, SameHostDaemon)
504 505
 	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)
505 511
 
506 512
 	// TODO Windows: Temporary check - remove once TP5 support is dropped
507 513
 	if daemonPlatform == "windows" && windowsDaemonKV < 14350 {
508 514
 		c.Skip("Needs later Windows build for RO volumes")
509 515
 	}
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")
511 517
 
512 518
 	// Expect this "rw" mode to be be ignored since the inherited volume is "ro"
513 519
 	if _, _, err := dockerCmdWithError("run", "--volumes-from", "parent:rw", "busybox", "touch", prefix+slash+"test"+slash+"file"); err == nil {
514 520
 		c.Fatal("Expected volumes-from to inherit read-only volume even when passing in `rw`")
515 521
 	}
516 522
 
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")
518 524
 
519 525
 	// Expect this to be read-only since both are "ro"
520 526
 	if _, _, err := dockerCmdWithError("run", "--volumes-from", "parent2:ro", "busybox", "touch", prefix+slash+"test"+slash+"file"); err == nil {