Deprecate /containers/(id or name)/copy endpoint
This endpoint has been deprecated since 1.8. Return an error starting from this API version (1.24) in order to make sure it's not used for the next API version and so that we can remove it some times later. Signed-off-by: Vincent Demeester <vincent@sbr.pm> Upstream-commit: 428328908dc529b1678fb3d8b033fb0591a294e3 Component: engine
This commit is contained in:
@ -892,7 +892,7 @@ func (s *DockerSuite) TestContainerApiWait(c *check.C) {
|
||||
c.Assert(waitres.StatusCode, checker.Equals, 0)
|
||||
}
|
||||
|
||||
func (s *DockerSuite) TestContainerApiCopy(c *check.C) {
|
||||
func (s *DockerSuite) TestContainerApiCopyNotExistsAnyMore(c *check.C) {
|
||||
// TODO Windows to Windows CI. This can be ported.
|
||||
testRequires(c, DaemonIsLinux)
|
||||
name := "test-container-api-copy"
|
||||
@ -902,7 +902,22 @@ func (s *DockerSuite) TestContainerApiCopy(c *check.C) {
|
||||
Resource: "/test.txt",
|
||||
}
|
||||
|
||||
status, body, err := sockRequest("POST", "/containers/"+name+"/copy", postData)
|
||||
status, _, err := sockRequest("POST", "/containers/"+name+"/copy", postData)
|
||||
c.Assert(err, checker.IsNil)
|
||||
c.Assert(status, checker.Equals, http.StatusNotFound)
|
||||
}
|
||||
|
||||
func (s *DockerSuite) TestContainerApiCopyPre124(c *check.C) {
|
||||
// TODO Windows to Windows CI. This can be ported.
|
||||
testRequires(c, DaemonIsLinux)
|
||||
name := "test-container-api-copy"
|
||||
dockerCmd(c, "run", "--name", name, "busybox", "touch", "/test.txt")
|
||||
|
||||
postData := types.CopyConfig{
|
||||
Resource: "/test.txt",
|
||||
}
|
||||
|
||||
status, body, err := sockRequest("POST", "/v1.23/containers/"+name+"/copy", postData)
|
||||
c.Assert(err, checker.IsNil)
|
||||
c.Assert(status, checker.Equals, http.StatusOK)
|
||||
|
||||
@ -923,7 +938,7 @@ func (s *DockerSuite) TestContainerApiCopy(c *check.C) {
|
||||
c.Assert(found, checker.True)
|
||||
}
|
||||
|
||||
func (s *DockerSuite) TestContainerApiCopyResourcePathEmpty(c *check.C) {
|
||||
func (s *DockerSuite) TestContainerApiCopyResourcePathEmptyPr124(c *check.C) {
|
||||
// TODO Windows to Windows CI. This can be ported.
|
||||
testRequires(c, DaemonIsLinux)
|
||||
name := "test-container-api-copy-resource-empty"
|
||||
@ -933,13 +948,13 @@ func (s *DockerSuite) TestContainerApiCopyResourcePathEmpty(c *check.C) {
|
||||
Resource: "",
|
||||
}
|
||||
|
||||
status, body, err := sockRequest("POST", "/containers/"+name+"/copy", postData)
|
||||
status, body, err := sockRequest("POST", "/v1.23/containers/"+name+"/copy", postData)
|
||||
c.Assert(err, checker.IsNil)
|
||||
c.Assert(status, checker.Equals, http.StatusInternalServerError)
|
||||
c.Assert(string(body), checker.Matches, "Path cannot be empty\n")
|
||||
}
|
||||
|
||||
func (s *DockerSuite) TestContainerApiCopyResourcePathNotFound(c *check.C) {
|
||||
func (s *DockerSuite) TestContainerApiCopyResourcePathNotFoundPre124(c *check.C) {
|
||||
// TODO Windows to Windows CI. This can be ported.
|
||||
testRequires(c, DaemonIsLinux)
|
||||
name := "test-container-api-copy-resource-not-found"
|
||||
@ -949,18 +964,18 @@ func (s *DockerSuite) TestContainerApiCopyResourcePathNotFound(c *check.C) {
|
||||
Resource: "/notexist",
|
||||
}
|
||||
|
||||
status, body, err := sockRequest("POST", "/containers/"+name+"/copy", postData)
|
||||
status, body, err := sockRequest("POST", "/v1.23/containers/"+name+"/copy", postData)
|
||||
c.Assert(err, checker.IsNil)
|
||||
c.Assert(status, checker.Equals, http.StatusInternalServerError)
|
||||
c.Assert(string(body), checker.Matches, "Could not find the file /notexist in container "+name+"\n")
|
||||
}
|
||||
|
||||
func (s *DockerSuite) TestContainerApiCopyContainerNotFound(c *check.C) {
|
||||
func (s *DockerSuite) TestContainerApiCopyContainerNotFoundPr124(c *check.C) {
|
||||
postData := types.CopyConfig{
|
||||
Resource: "/something",
|
||||
}
|
||||
|
||||
status, _, err := sockRequest("POST", "/containers/notexists/copy", postData)
|
||||
status, _, err := sockRequest("POST", "/v1.23/containers/notexists/copy", postData)
|
||||
c.Assert(err, checker.IsNil)
|
||||
c.Assert(status, checker.Equals, http.StatusNotFound)
|
||||
}
|
||||
|
||||
Reference in New Issue
Block a user