Selaa lähdekoodia

Windows: Test for run as local system

Signed-off-by: John Howard <jhoward@microsoft.com>
John Howard 8 vuotta sitten
vanhempi
commit
ffbe4b6ff1
1 muutettua tiedostoa jossa 10 lisäystä ja 0 poistoa
  1. 10 0
      integration-cli/docker_cli_run_test.go

+ 10 - 0
integration-cli/docker_cli_run_test.go

@@ -4429,3 +4429,13 @@ func (s *DockerSuite) TestRunAddDeviceCgroupRule(c *check.C) {
 	out, _ = dockerCmd(c, "run", "--rm", fmt.Sprintf("--device-cgroup-rule=%s", deviceRule), "busybox", "grep", deviceRule, "/sys/fs/cgroup/devices/devices.list")
 	out, _ = dockerCmd(c, "run", "--rm", fmt.Sprintf("--device-cgroup-rule=%s", deviceRule), "busybox", "grep", deviceRule, "/sys/fs/cgroup/devices/devices.list")
 	c.Assert(strings.TrimSpace(out), checker.Equals, deviceRule)
 	c.Assert(strings.TrimSpace(out), checker.Equals, deviceRule)
 }
 }
+
+// Verifies that running as local system is operating correctly on Windows
+func (s *DockerSuite) TestWindowsRunAsSystem(c *check.C) {
+	testRequires(c, DaemonIsWindows)
+	if testEnv.DaemonKernelVersionNumeric() < 15000 {
+		c.Skip("Requires build 15000 or later")
+	}
+	out, _ := dockerCmd(c, "run", "--net=none", `--user=nt authority\system`, "--hostname=XYZZY", minimalBaseImage(), "cmd", "/c", `@echo %USERNAME%`)
+	c.Assert(strings.TrimSpace(out), checker.Equals, "XYZZY$")
+}