Skip to content

Commit

Permalink
Merge pull request #9638 from crosbymichael/build-volumes-retain-cont…
Browse files Browse the repository at this point in the history
…ents

Add test to enforce volume build content
  • Loading branch information
crosbymichael committed Dec 15, 2014
2 parents 03142fd + 4856ec0 commit b84bfb4
Showing 1 changed file with 34 additions and 0 deletions.
34 changes: 34 additions & 0 deletions integration-cli/docker_cli_build_test.go
Original file line number Diff line number Diff line change
Expand Up @@ -3914,3 +3914,37 @@ RUN [ ! -e /injected ]`,

logDone("build - xz host is being used")
}

func TestBuildVolumesRetainContents(t *testing.T) {
var (
name = "testbuildvolumescontent"
expected = "some text"
)
defer deleteImages(name)
ctx, err := fakeContext(`
FROM busybox
COPY content /foo/file
VOLUME /foo
CMD cat /foo/file`,
map[string]string{
"content": expected,
})
if err != nil {
t.Fatal(err)
}
defer ctx.Close()

if _, err := buildImageFromContext(name, ctx, false); err != nil {
t.Fatal(err)
}

out, _, err := runCommandWithOutput(exec.Command(dockerBinary, "run", "--rm", name))
if err != nil {
t.Fatal(err)
}
if out != expected {
t.Fatalf("expected file contents for /foo/file to be %q but received %q", expected, out)
}

logDone("build - volumes retain contents in build")
}

0 comments on commit b84bfb4

Please sign in to comment.