From 230179c8dc120b4b1a181e24de055bdca7963491 Mon Sep 17 00:00:00 2001 From: Yuan Sun Date: Fri, 3 Jul 2015 23:25:52 +0800 Subject: [PATCH] add TestRunCapAddCHOWN test case Signed-off-by: Yuan Sun --- integration-cli/docker_cli_run_test.go | 12 ++++++++++++ 1 file changed, 12 insertions(+) diff --git a/integration-cli/docker_cli_run_test.go b/integration-cli/docker_cli_run_test.go index 97b8658e21..1b1e429d7a 100644 --- a/integration-cli/docker_cli_run_test.go +++ b/integration-cli/docker_cli_run_test.go @@ -3220,3 +3220,15 @@ func (s *DockerSuite) TestRunContainerNetModeWithExposePort(c *check.C) { } } + +func (s *DockerSuite) TestRunCapAddCHOWN(c *check.C) { + cmd := exec.Command(dockerBinary, "run", "--cap-drop=ALL", "--cap-add=CHOWN", "busybox", "sh", "-c", "adduser -D -H newuser && chown newuser /home && echo ok") + out, _, err := runCommandWithOutput(cmd) + if err != nil { + c.Fatal(err, out) + } + + if actual := strings.Trim(out, "\r\n"); actual != "ok" { + c.Fatalf("expected output ok received %s", actual) + } +}