mirror of
https://github.com/moby/moby.git
synced 2025-08-01 05:47:11 +03:00
Restapi for stop fails if ?t=int not present
Signed-off-by: Srini Brahmaroutu <srbrahma@us.ibm.com>
This commit is contained in:
@ -1202,3 +1202,22 @@ func (s *DockerSuite) TestContainersApiChunkedEncoding(c *check.C) {
|
||||
c.Fatalf("got incorrect bind spec, wanted %s, got: %s", expected, binds[0])
|
||||
}
|
||||
}
|
||||
|
||||
func (s *DockerSuite) TestPostContainerStop(c *check.C) {
|
||||
runCmd := exec.Command(dockerBinary, "run", "-d", "busybox", "top")
|
||||
out, _, err := runCommandWithOutput(runCmd)
|
||||
c.Assert(err, check.IsNil)
|
||||
|
||||
containerID := strings.TrimSpace(out)
|
||||
c.Assert(waitRun(containerID), check.IsNil)
|
||||
|
||||
statusCode, _, err := sockRequest("POST", "/containers/"+containerID+"/stop", nil)
|
||||
|
||||
// 204 No Content is expected, not 200
|
||||
c.Assert(statusCode, check.Equals, http.StatusNoContent)
|
||||
c.Assert(err, check.IsNil)
|
||||
|
||||
if err := waitInspect(containerID, "{{ .State.Running }}", "false", 5); err != nil {
|
||||
c.Fatal(err)
|
||||
}
|
||||
}
|
||||
|
Reference in New Issue
Block a user