Browse code

Adds test for additional groups.

Signed-off-by: Mrunal Patel <mrunalp@gmail.com>

Mrunal Patel authored on 2015/06/18 03:39:59
Showing 1 changed files
... ...
@@ -948,6 +948,19 @@ func (s *DockerSuite) TestRunCapAddALLDropNetAdminCanDownInterface(c *check.C) {
948 948
 	}
949 949
 }
950 950
 
951
+func (s *DockerSuite) TestRunGroupAdd(c *check.C) {
952
+	cmd := exec.Command(dockerBinary, "run", "--group-add=audio", "--group-add=dbus", "--group-add=777", "busybox", "sh", "-c", "id")
953
+	out, _, err := runCommandWithOutput(cmd)
954
+	if err != nil {
955
+		c.Fatal(err, out)
956
+	}
957
+
958
+	groupsList := "uid=0(root) gid=0(root) groups=10(wheel),29(audio),81(dbus),777"
959
+	if actual := strings.Trim(out, "\r\n"); actual != groupsList {
960
+		c.Fatalf("expected output %s received %s", groupsList, actual)
961
+	}
962
+}
963
+
951 964
 func (s *DockerSuite) TestRunPrivilegedCanMount(c *check.C) {
952 965
 	cmd := exec.Command(dockerBinary, "run", "--privileged", "busybox", "sh", "-c", "mount -t tmpfs none /tmp && echo ok")
953 966
 	out, _, err := runCommandWithOutput(cmd)