소스 검색

add TestRunCapAddCHOWN test case

Signed-off-by: Yuan Sun <sunyuan3@huawei.com>
Yuan Sun 10 년 전
부모
커밋
230179c8dc
1개의 변경된 파일12개의 추가작업 그리고 0개의 파일을 삭제
  1. 12 0
      integration-cli/docker_cli_run_test.go

+ 12 - 0
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)
+	}
+}