mirror of
https://github.com/moby/moby.git
synced 2022-11-09 12:21:53 -05:00
Do not check and return strconv.Atoi error in api container restart, regression
Signed-off-by: Antonio Murdaca <me@runcom.ninja>
This commit is contained in:
parent
4b4adae41c
commit
74121a4211
2 changed files with 20 additions and 4 deletions
|
@ -917,10 +917,7 @@ func (s *Server) postContainersRestart(version version.Version, w http.ResponseW
|
|||
return fmt.Errorf("Missing parameter")
|
||||
}
|
||||
|
||||
timeout, err := strconv.Atoi(r.Form.Get("t"))
|
||||
if err != nil {
|
||||
return err
|
||||
}
|
||||
timeout, _ := strconv.Atoi(r.Form.Get("t"))
|
||||
|
||||
if err := s.daemon.ContainerRestart(vars["name"], timeout); err != nil {
|
||||
return err
|
||||
|
|
|
@ -899,6 +899,25 @@ func (s *DockerSuite) TestContainerApiRestart(c *check.C) {
|
|||
}
|
||||
}
|
||||
|
||||
func (s *DockerSuite) TestContainerApiRestartNotimeoutParam(c *check.C) {
|
||||
name := "test-api-restart-no-timeout-param"
|
||||
runCmd := exec.Command(dockerBinary, "run", "-di", "--name", name, "busybox", "top")
|
||||
out, _, err := runCommandWithOutput(runCmd)
|
||||
if err != nil {
|
||||
c.Fatalf("Error on container creation: %v, output: %q", err, out)
|
||||
}
|
||||
id := strings.TrimSpace(out)
|
||||
c.Assert(waitRun(id), check.IsNil)
|
||||
|
||||
status, _, err := sockRequest("POST", "/containers/"+name+"/restart", nil)
|
||||
c.Assert(status, check.Equals, http.StatusNoContent)
|
||||
c.Assert(err, check.IsNil)
|
||||
|
||||
if err := waitInspect(name, "{{ .State.Restarting }} {{ .State.Running }}", "false true", 5); err != nil {
|
||||
c.Fatal(err)
|
||||
}
|
||||
}
|
||||
|
||||
func (s *DockerSuite) TestContainerApiStart(c *check.C) {
|
||||
name := "testing-start"
|
||||
config := map[string]interface{}{
|
||||
|
|
Loading…
Add table
Reference in a new issue