Browse code

Windows: Test for run as local system

Signed-off-by: John Howard <jhoward@microsoft.com>

John Howard authored on 2017/01/11 08:54:24
Showing 1 changed files
... ...
@@ -4429,3 +4429,13 @@ func (s *DockerSuite) TestRunAddDeviceCgroupRule(c *check.C) {
4429 4429
 	out, _ = dockerCmd(c, "run", "--rm", fmt.Sprintf("--device-cgroup-rule=%s", deviceRule), "busybox", "grep", deviceRule, "/sys/fs/cgroup/devices/devices.list")
4430 4430
 	c.Assert(strings.TrimSpace(out), checker.Equals, deviceRule)
4431 4431
 }
4432
+
4433
+// Verifies that running as local system is operating correctly on Windows
4434
+func (s *DockerSuite) TestWindowsRunAsSystem(c *check.C) {
4435
+	testRequires(c, DaemonIsWindows)
4436
+	if testEnv.DaemonKernelVersionNumeric() < 15000 {
4437
+		c.Skip("Requires build 15000 or later")
4438
+	}
4439
+	out, _ := dockerCmd(c, "run", "--net=none", `--user=nt authority\system`, "--hostname=XYZZY", minimalBaseImage(), "cmd", "/c", `@echo %USERNAME%`)
4440
+	c.Assert(strings.TrimSpace(out), checker.Equals, "XYZZY$")
4441
+}