فهرست منبع

Add test for volume ownership and perms
Docker-DCO-1.1-Signed-off-by: Michael Crosby <michael@crosbymichael.com> (github: crosbymichael)

Michael Crosby 11 سال پیش
والد
کامیت
c024c9bd1e
1فایلهای تغییر یافته به همراه32 افزوده شده و 0 حذف شده
  1. 32 0
      integration-cli/docker_cli_build_test.go

+ 32 - 0
integration-cli/docker_cli_build_test.go

@@ -1067,6 +1067,7 @@ func TestBuildADDLocalAndRemoteFilesWithCache(t *testing.T) {
 	logDone("build - add local and remote file with cache")
 }
 
+// TODO: TestCaching
 func TestBuildADDLocalAndRemoteFilesWithoutCache(t *testing.T) {
 	name := "testbuildaddlocalandremotefilewithoutcache"
 	defer deleteImages(name)
@@ -1101,3 +1102,34 @@ func TestBuildADDLocalAndRemoteFilesWithoutCache(t *testing.T) {
 	}
 	logDone("build - add local and remote file without cache")
 }
+
+func TestBuildWithVolumeOwnership(t *testing.T) {
+	name := "testbuildimg"
+	defer deleteImages(name)
+
+	_, err := buildImage(name,
+		`FROM busybox:latest
+        RUN mkdir /test && chown daemon:daemon /test && chmod 0600 /test
+        VOLUME /test`,
+		true)
+
+	if err != nil {
+		t.Fatal(err)
+	}
+
+	cmd := exec.Command(dockerBinary, "run", "--rm", "testbuildimg", "ls", "-la", "/test")
+	out, _, err := runCommandWithOutput(cmd)
+	if err != nil {
+		t.Fatal(err)
+	}
+
+	if expected := "drw-------"; !strings.Contains(out, expected) {
+		t.Fatalf("expected %s received %s", expected, out)
+	}
+
+	if expected := "daemon   daemon"; !strings.Contains(out, expected) {
+		t.Fatalf("expected %s received %s", expected, out)
+	}
+
+	logDone("build - volume ownership")
+}