mirror of
https://github.com/moby/moby.git
synced 2022-11-09 12:21:53 -05:00
Add test for volume ownership and perms
Docker-DCO-1.1-Signed-off-by: Michael Crosby <michael@crosbymichael.com> (github: crosbymichael)
This commit is contained in:
parent
f41ced96af
commit
c024c9bd1e
1 changed files with 32 additions and 0 deletions
|
@ -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")
|
||||
}
|
||||
|
|
Loading…
Reference in a new issue