Merge pull request #30040 from Microsoft/jjh/ntauthority

Windows: Test for run as local system
This commit is contained in:
Vincent Demeester 2017-02-02 12:13:55 +01:00 committed by GitHub
commit ada44345dd

View file

@ -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")
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$")
}