mirror of
https://github.com/moby/moby.git
synced 2025-07-29 07:21:35 +03:00
Check for nil before using HostConfig to adjustCpuShares
Fix #14915. Add unit test for #14915. Thanks @runcom for the test case: when the client calls 1.18 api version w/o hostconfig it results in a nil pointer dereference. Signed-off-by: Stephen Rust <srust@blockbridge.com>
This commit is contained in:
@ -1687,3 +1687,13 @@ func (s *DockerSuite) TestPostContainersStartWithLinksInHostConfigIdLinked(c *ch
|
||||
c.Assert(res.StatusCode, check.Equals, http.StatusNoContent)
|
||||
b.Close()
|
||||
}
|
||||
|
||||
// #14915
|
||||
func (s *DockerSuite) TestContainersApiCreateNoHostConfig118(c *check.C) {
|
||||
config := struct {
|
||||
Image string
|
||||
}{"busybox"}
|
||||
status, _, err := sockRequest("POST", "/v1.18/containers/create", config)
|
||||
c.Assert(err, check.IsNil)
|
||||
c.Assert(status, check.Equals, http.StatusCreated)
|
||||
}
|
||||
|
Reference in New Issue
Block a user