Browse code

Merge pull request #13557 from ewindisch/apparmor-unshare-priv

Expand unshare test to include privileged test

Phil Estes authored on 2015/06/02 04:43:37
Showing 1 changed files
... ...
@@ -3144,6 +3144,13 @@ func (s *DockerSuite) TestRunUnshareProc(c *check.C) {
3144 3144
 	if out, _, err := runCommandWithOutput(runCmd); err == nil || !strings.Contains(out, "Permission denied") {
3145 3145
 		c.Fatalf("unshare should have failed with permission denied, got: %s, %v", out, err)
3146 3146
 	}
3147
+
3148
+	/* Ensure still fails if running privileged with the default policy */
3149
+	name = "crashoverride"
3150
+	runCmd = exec.Command(dockerBinary, "run", "--privileged", "--security-opt", "apparmor:docker-default", "--name", name, "jess/unshare", "unshare", "-p", "-m", "-f", "-r", "mount", "-t", "proc", "none", "/proc")
3151
+	if out, _, err := runCommandWithOutput(runCmd); err == nil || !strings.Contains(out, "Permission denied") {
3152
+		c.Fatalf("unshare should have failed with permission denied, got: %s, %v", out, err)
3153
+	}
3147 3154
 }
3148 3155
 
3149 3156
 func (s *DockerSuite) TestRunPublishPort(c *check.C) {