mirror of
https://github.com/clearlinux/docker.git
synced 2026-09-06 13:41:36 +00:00
add basic support for 'all'
Docker-DCO-1.1-Signed-off-by: Victor Vieux <vieux@docker.com> (github: vieux)
This commit is contained in:
@@ -798,6 +798,21 @@ func TestCapDropCannotMknod(t *testing.T) {
|
||||
logDone("run - test --cap-drop=MKNOD cannot mknod")
|
||||
}
|
||||
|
||||
func TestCapDropALLCannotMknod(t *testing.T) {
|
||||
cmd := exec.Command(dockerBinary, "run", "--cap-drop=ALL", "busybox", "sh", "-c", "mknod /tmp/sda b 8 0 && echo ok")
|
||||
out, _, err := runCommandWithOutput(cmd)
|
||||
if err == nil {
|
||||
t.Fatal(err, out)
|
||||
}
|
||||
|
||||
if actual := strings.Trim(out, "\r\n"); actual == "ok" {
|
||||
t.Fatalf("expected output not ok received %s", actual)
|
||||
}
|
||||
deleteAllContainers()
|
||||
|
||||
logDone("run - test --cap-drop=ALL cannot mknod")
|
||||
}
|
||||
|
||||
func TestCapAddCanDownInterface(t *testing.T) {
|
||||
cmd := exec.Command(dockerBinary, "run", "--cap-add=NET_ADMIN", "busybox", "sh", "-c", "ip link set eth0 down && echo ok")
|
||||
out, _, err := runCommandWithOutput(cmd)
|
||||
@@ -813,6 +828,21 @@ func TestCapAddCanDownInterface(t *testing.T) {
|
||||
logDone("run - test --cap-add=NET_ADMIN can set eth0 down")
|
||||
}
|
||||
|
||||
func TestCapAddALLCanDownInterface(t *testing.T) {
|
||||
cmd := exec.Command(dockerBinary, "run", "--cap-add=ALL", "busybox", "sh", "-c", "ip link set eth0 down && echo ok")
|
||||
out, _, err := runCommandWithOutput(cmd)
|
||||
if err != nil {
|
||||
t.Fatal(err, out)
|
||||
}
|
||||
|
||||
if actual := strings.Trim(out, "\r\n"); actual != "ok" {
|
||||
t.Fatalf("expected output ok received %s", actual)
|
||||
}
|
||||
deleteAllContainers()
|
||||
|
||||
logDone("run - test --cap-add=ALL can set eth0 down")
|
||||
}
|
||||
|
||||
func TestPrivilegedCanMount(t *testing.T) {
|
||||
cmd := exec.Command(dockerBinary, "run", "--privileged", "busybox", "sh", "-c", "mount -t tmpfs none /tmp && echo ok")
|
||||
|
||||
|
||||
Reference in New Issue
Block a user