Skip to content

Commit fe6b88e

Browse files
committed
integration-cli: fix minimum and default api version test
Signed-off-by: Antonio Murdaca <runcom@redhat.com>
1 parent 38e774d commit fe6b88e

File tree

1 file changed

+5
-2
lines changed

1 file changed

+5
-2
lines changed

integration-cli/docker_api_test.go

Lines changed: 5 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -1,6 +1,7 @@
11
package main
22

33
import (
4+
"fmt"
45
"net/http"
56
"net/http/httptest"
67
"net/http/httputil"
@@ -59,7 +60,8 @@ func (s *DockerSuite) TestApiClientVersionNewerThanServer(c *check.C) {
5960
status, body, err := sockRequest("GET", "/v"+version+"/version", nil)
6061
c.Assert(err, checker.IsNil)
6162
c.Assert(status, checker.Equals, http.StatusBadRequest)
62-
c.Assert(len(string(body)), check.Not(checker.Equals), 0) // Expected not empty body
63+
expected := fmt.Sprintf("client is newer than server (client API version: %s, server API version: %s)", version, api.DefaultVersion)
64+
c.Assert(strings.TrimSpace(string(body)), checker.Equals, expected)
6365
}
6466

6567
func (s *DockerSuite) TestApiClientVersionOldNotSupported(c *check.C) {
@@ -73,7 +75,8 @@ func (s *DockerSuite) TestApiClientVersionOldNotSupported(c *check.C) {
7375
status, body, err := sockRequest("GET", "/v"+version+"/version", nil)
7476
c.Assert(err, checker.IsNil)
7577
c.Assert(status, checker.Equals, http.StatusBadRequest)
76-
c.Assert(len(string(body)), checker.Not(check.Equals), 0) // Expected not empty body
78+
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)
79+
c.Assert(strings.TrimSpace(string(body)), checker.Equals, expected)
7780
}
7881

7982
func (s *DockerSuite) TestApiDockerApiVersion(c *check.C) {

0 commit comments

Comments
 (0)