Browse Source

Adds test for additional groups.

Signed-off-by: Mrunal Patel <mrunalp@gmail.com>
Mrunal Patel 10 years ago
parent
commit
0b7938e845
1 changed files with 13 additions and 0 deletions
  1. 13 0
      integration-cli/docker_cli_run_test.go

+ 13 - 0
integration-cli/docker_cli_run_test.go

@@ -948,6 +948,19 @@ func (s *DockerSuite) TestRunCapAddALLDropNetAdminCanDownInterface(c *check.C) {
 	}
 	}
 }
 }
 
 
+func (s *DockerSuite) TestRunGroupAdd(c *check.C) {
+	cmd := exec.Command(dockerBinary, "run", "--group-add=audio", "--group-add=dbus", "--group-add=777", "busybox", "sh", "-c", "id")
+	out, _, err := runCommandWithOutput(cmd)
+	if err != nil {
+		c.Fatal(err, out)
+	}
+
+	groupsList := "uid=0(root) gid=0(root) groups=10(wheel),29(audio),81(dbus),777"
+	if actual := strings.Trim(out, "\r\n"); actual != groupsList {
+		c.Fatalf("expected output %s received %s", groupsList, actual)
+	}
+}
+
 func (s *DockerSuite) TestRunPrivilegedCanMount(c *check.C) {
 func (s *DockerSuite) TestRunPrivilegedCanMount(c *check.C) {
 	cmd := exec.Command(dockerBinary, "run", "--privileged", "busybox", "sh", "-c", "mount -t tmpfs none /tmp && echo ok")
 	cmd := exec.Command(dockerBinary, "run", "--privileged", "busybox", "sh", "-c", "mount -t tmpfs none /tmp && echo ok")
 	out, _, err := runCommandWithOutput(cmd)
 	out, _, err := runCommandWithOutput(cmd)