Esempio n. 1
0
// regression gh14320
func (s *DockerSuite) TestPostContainersAttachContainerNotFound(c *check.C) {
	client, err := request.NewClient(daemonHost())
	c.Assert(err, checker.IsNil)
	req, err := request.New(daemonHost(), "/containers/doesnotexist/attach", request.Method(http.MethodPost))
	resp, err := client.Do(req)
	// connection will shutdown, err should be "persistent connection closed"
	c.Assert(resp.StatusCode, checker.Equals, http.StatusNotFound)
	content, err := testutil.ReadBody(resp.Body)
	c.Assert(err, checker.IsNil)
	expected := "No such container: doesnotexist\r\n"
	c.Assert(string(content), checker.Equals, expected)
}
Esempio n. 2
0
func (s *DockerSuite) TestAPIOptionsRoute(c *check.C) {
	resp, _, err := request.Do(daemonHost(), "/", request.Method(http.MethodOptions))
	c.Assert(err, checker.IsNil)
	c.Assert(resp.StatusCode, checker.Equals, http.StatusOK)
}