Browse code

api/server/router/system: fix info versioning

Signed-off-by: Antonio Murdaca <runcom@redhat.com>

Antonio Murdaca authored on 2016/10/21 18:43:00
Showing 2 changed files
... ...
@@ -38,7 +38,7 @@ func (s *systemRouter) getInfo(ctx context.Context, w http.ResponseWriter, r *ht
38 38
 		info.Swarm = s.clusterProvider.Info()
39 39
 	}
40 40
 
41
-	if versions.LessThan("1.25", httputils.VersionFromContext(ctx)) {
41
+	if versions.LessThan(httputils.VersionFromContext(ctx), "1.25") {
42 42
 		// TODO: handle this conversion in engine-api
43 43
 		type oldInfo struct {
44 44
 			*types.Info
... ...
@@ -38,3 +38,15 @@ func (s *DockerSuite) TestInfoAPI(c *check.C) {
38 38
 		c.Assert(out, checker.Contains, linePrefix)
39 39
 	}
40 40
 }
41
+
42
+func (s *DockerSuite) TestInfoAPIVersioned(c *check.C) {
43
+	endpoint := "/v1.20/info"
44
+
45
+	status, body, err := sockRequest("GET", endpoint, nil)
46
+	c.Assert(status, checker.Equals, http.StatusOK)
47
+	c.Assert(err, checker.IsNil)
48
+
49
+	out := string(body)
50
+	c.Assert(out, checker.Contains, "ExecutionDriver")
51
+	c.Assert(out, checker.Contains, "not supported")
52
+}