integration-cli: fix minimum and default api version test

Signed-off-by: Antonio Murdaca <runcom@redhat.com>
Upstream-commit: fe6b88e3fa12810b2eaad45c613742c1eeb7290e
Component: engine
This commit is contained in:
Antonio Murdaca
2016-02-04 13:47:15 +01:00
parent 76c413d163
commit 83fc309845

View File

@ -1,6 +1,7 @@
package main
import (
"fmt"
"net/http"
"net/http/httptest"
"net/http/httputil"
@ -59,7 +60,8 @@ func (s *DockerSuite) TestApiClientVersionNewerThanServer(c *check.C) {
status, body, err := sockRequest("GET", "/v"+version+"/version", nil)
c.Assert(err, checker.IsNil)
c.Assert(status, checker.Equals, http.StatusBadRequest)
c.Assert(len(string(body)), check.Not(checker.Equals), 0) // Expected not empty body
expected := fmt.Sprintf("client is newer than server (client API version: %s, server API version: %s)", version, api.DefaultVersion)
c.Assert(strings.TrimSpace(string(body)), checker.Equals, expected)
}
func (s *DockerSuite) TestApiClientVersionOldNotSupported(c *check.C) {
@ -73,7 +75,8 @@ func (s *DockerSuite) TestApiClientVersionOldNotSupported(c *check.C) {
status, body, err := sockRequest("GET", "/v"+version+"/version", nil)
c.Assert(err, checker.IsNil)
c.Assert(status, checker.Equals, http.StatusBadRequest)
c.Assert(len(string(body)), checker.Not(check.Equals), 0) // Expected not empty body
expected := fmt.Sprintf("client version %s is too old. Minimum supported API version is %s, please upgrade your client to a newer version", version, api.MinVersion)
c.Assert(strings.TrimSpace(string(body)), checker.Equals, expected)
}
func (s *DockerSuite) TestApiDockerApiVersion(c *check.C) {