1
0
Fork 0
mirror of https://github.com/moby/moby.git synced 2022-11-09 12:21:53 -05:00

Windows CI: Port TestKill*

Signed-off-by: John Howard <jhoward@microsoft.com>
This commit is contained in:
John Howard 2016-02-24 13:33:25 -08:00
parent a7fefcf16c
commit 03e2ff322b

View file

@ -10,8 +10,7 @@ import (
) )
func (s *DockerSuite) TestKillContainer(c *check.C) { func (s *DockerSuite) TestKillContainer(c *check.C) {
testRequires(c, DaemonIsLinux) out, _ := runSleepingContainer(c, "-d")
out, _ := dockerCmd(c, "run", "-d", "busybox", "top")
cleanedContainerID := strings.TrimSpace(out) cleanedContainerID := strings.TrimSpace(out)
c.Assert(waitRun(cleanedContainerID), check.IsNil) c.Assert(waitRun(cleanedContainerID), check.IsNil)
@ -22,9 +21,8 @@ func (s *DockerSuite) TestKillContainer(c *check.C) {
} }
func (s *DockerSuite) TestKillofStoppedContainer(c *check.C) { func (s *DockerSuite) TestKillOffStoppedContainer(c *check.C) {
testRequires(c, DaemonIsLinux) out, _ := runSleepingContainer(c, "-d")
out, _ := dockerCmd(c, "run", "-d", "busybox", "top")
cleanedContainerID := strings.TrimSpace(out) cleanedContainerID := strings.TrimSpace(out)
dockerCmd(c, "stop", cleanedContainerID) dockerCmd(c, "stop", cleanedContainerID)
@ -34,6 +32,7 @@ func (s *DockerSuite) TestKillofStoppedContainer(c *check.C) {
} }
func (s *DockerSuite) TestKillDifferentUserContainer(c *check.C) { func (s *DockerSuite) TestKillDifferentUserContainer(c *check.C) {
// TODO Windows: Windows does not yet support -u (Feb 2016).
testRequires(c, DaemonIsLinux) testRequires(c, DaemonIsLinux)
out, _ := dockerCmd(c, "run", "-u", "daemon", "-d", "busybox", "top") out, _ := dockerCmd(c, "run", "-u", "daemon", "-d", "busybox", "top")
cleanedContainerID := strings.TrimSpace(out) cleanedContainerID := strings.TrimSpace(out)
@ -48,6 +47,7 @@ func (s *DockerSuite) TestKillDifferentUserContainer(c *check.C) {
// regression test about correct signal parsing see #13665 // regression test about correct signal parsing see #13665
func (s *DockerSuite) TestKillWithSignal(c *check.C) { func (s *DockerSuite) TestKillWithSignal(c *check.C) {
// Cannot port to Windows - does not support signals in the same was a Linux does
testRequires(c, DaemonIsLinux) testRequires(c, DaemonIsLinux)
out, _ := dockerCmd(c, "run", "-d", "busybox", "top") out, _ := dockerCmd(c, "run", "-d", "busybox", "top")
cid := strings.TrimSpace(out) cid := strings.TrimSpace(out)
@ -61,8 +61,7 @@ func (s *DockerSuite) TestKillWithSignal(c *check.C) {
} }
func (s *DockerSuite) TestKillWithInvalidSignal(c *check.C) { func (s *DockerSuite) TestKillWithInvalidSignal(c *check.C) {
testRequires(c, DaemonIsLinux) out, _ := runSleepingContainer(c, "-d")
out, _ := dockerCmd(c, "run", "-d", "busybox", "top")
cid := strings.TrimSpace(out) cid := strings.TrimSpace(out)
c.Assert(waitRun(cid), check.IsNil) c.Assert(waitRun(cid), check.IsNil)
@ -73,7 +72,7 @@ func (s *DockerSuite) TestKillWithInvalidSignal(c *check.C) {
running := inspectField(c, cid, "State.Running") running := inspectField(c, cid, "State.Running")
c.Assert(running, checker.Equals, "true", check.Commentf("Container should be in running state after an invalid signal")) c.Assert(running, checker.Equals, "true", check.Commentf("Container should be in running state after an invalid signal"))
out, _ = dockerCmd(c, "run", "-d", "busybox", "top") out, _ = runSleepingContainer(c, "-d")
cid = strings.TrimSpace(out) cid = strings.TrimSpace(out)
c.Assert(waitRun(cid), check.IsNil) c.Assert(waitRun(cid), check.IsNil)
@ -87,8 +86,7 @@ func (s *DockerSuite) TestKillWithInvalidSignal(c *check.C) {
} }
func (s *DockerSuite) TestKillStoppedContainerAPIPre120(c *check.C) { func (s *DockerSuite) TestKillStoppedContainerAPIPre120(c *check.C) {
testRequires(c, DaemonIsLinux) runSleepingContainer(c, "--name", "docker-kill-test-api", "-d")
dockerCmd(c, "run", "--name", "docker-kill-test-api", "-d", "busybox", "top")
dockerCmd(c, "stop", "docker-kill-test-api") dockerCmd(c, "stop", "docker-kill-test-api")
status, _, err := sockRequest("POST", fmt.Sprintf("/v1.19/containers/%s/kill", "docker-kill-test-api"), nil) status, _, err := sockRequest("POST", fmt.Sprintf("/v1.19/containers/%s/kill", "docker-kill-test-api"), nil)