Keep backwards compatibility in kill api.

Return an error when the container is stopped only in api versions
equal or greater than 1.20 (docker 1.8).

Signed-off-by: David Calavera <david.calavera@gmail.com>
(cherry picked from commit 621e3d8587)
This commit is contained in:
David Calavera
2015-07-29 16:44:21 -07:00
parent 43da1adedb
commit 689c4e6075
4 changed files with 34 additions and 12 deletions
+11
View File
@@ -1,6 +1,8 @@
package main
import (
"fmt"
"net/http"
"strings"
"github.com/go-check/check"
@@ -87,3 +89,12 @@ func (s *DockerSuite) TestKillWithInvalidSignal(c *check.C) {
c.Fatal("Container should be in running state after an invalid signal")
}
}
func (s *DockerSuite) TestKillofStoppedContainerAPIPre120(c *check.C) {
dockerCmd(c, "run", "--name", "docker-kill-test-api", "-d", "busybox", "top")
dockerCmd(c, "stop", "docker-kill-test-api")
status, _, err := sockRequest("POST", fmt.Sprintf("/v1.19/containers/%s/kill", "docker-kill-test-api"), nil)
c.Assert(err, check.IsNil)
c.Assert(status, check.Equals, http.StatusNoContent)
}