diff options
author | Tõnis Tiigi <tonistiigi@gmail.com> | 2017-08-28 09:50:44 -0700 |
---|---|---|
committer | GitHub <noreply@github.com> | 2017-08-28 09:50:44 -0700 |
commit | a1183dda578f531ef65766611f9e16a0636e3a17 (patch) | |
tree | 969de3cb713d42b1093f313e01ad209b8032c7dc /integration-cli/docker_api_build_test.go | |
parent | 964ba0eaa83ac44e614c7ca68fbe2d92c5435a8c (diff) | |
parent | 19a29f6fcf8354732cface3c656c3a3070230dcb (diff) | |
download | docker-a1183dda578f531ef65766611f9e16a0636e3a17.tar.gz |
Merge pull request #34263 from estesp/chown-flag-add-copy
Add --chown flag to ADD/COPY commands
Diffstat (limited to 'integration-cli/docker_api_build_test.go')
-rw-r--r-- | integration-cli/docker_api_build_test.go | 29 |
1 files changed, 29 insertions, 0 deletions
diff --git a/integration-cli/docker_api_build_test.go b/integration-cli/docker_api_build_test.go index fa6fc3556a..4f4da8cdf2 100644 --- a/integration-cli/docker_api_build_test.go +++ b/integration-cli/docker_api_build_test.go @@ -409,6 +409,35 @@ func (s *DockerSuite) TestBuildAddRemoteNoDecompress(c *check.C) { assert.Contains(c, string(out), "Successfully built") } +func (s *DockerSuite) TestBuildChownOnCopy(c *check.C) { + testRequires(c, DaemonIsLinux) + dockerfile := `FROM busybox + RUN echo 'test1:x:1001:1001::/bin:/bin/false' >> /etc/passwd + RUN echo 'test1:x:1001:' >> /etc/group + RUN echo 'test2:x:1002:' >> /etc/group + COPY --chown=test1:1002 . /new_dir + RUN ls -l / + RUN [ $(ls -l / | grep new_dir | awk '{print $3":"$4}') = 'test1:test2' ] + RUN [ $(ls -nl / | grep new_dir | awk '{print $3":"$4}') = '1001:1002' ] + ` + ctx := fakecontext.New(c, "", + fakecontext.WithDockerfile(dockerfile), + fakecontext.WithFile("test_file1", "some test content"), + ) + defer ctx.Close() + + res, body, err := request.Post( + "/build", + request.RawContent(ctx.AsTarReader(c)), + request.ContentType("application/x-tar")) + c.Assert(err, checker.IsNil) + c.Assert(res.StatusCode, checker.Equals, http.StatusOK) + + out, err := testutil.ReadBody(body) + require.NoError(c, err) + assert.Contains(c, string(out), "Successfully built") +} + func (s *DockerSuite) TestBuildWithSession(c *check.C) { testRequires(c, ExperimentalDaemon) |