Przeglądaj źródła

api/server/router/system: fix info versioning

Signed-off-by: Antonio Murdaca <runcom@redhat.com>
Antonio Murdaca 8 lat temu
rodzic
commit
63b5a37203

+ 1 - 1
api/server/router/system/system_routes.go

@@ -38,7 +38,7 @@ func (s *systemRouter) getInfo(ctx context.Context, w http.ResponseWriter, r *ht
 		info.Swarm = s.clusterProvider.Info()
 	}
 
-	if versions.LessThan("1.25", httputils.VersionFromContext(ctx)) {
+	if versions.LessThan(httputils.VersionFromContext(ctx), "1.25") {
 		// TODO: handle this conversion in engine-api
 		type oldInfo struct {
 			*types.Info

+ 12 - 0
integration-cli/docker_api_info_test.go

@@ -38,3 +38,15 @@ func (s *DockerSuite) TestInfoAPI(c *check.C) {
 		c.Assert(out, checker.Contains, linePrefix)
 	}
 }
+
+func (s *DockerSuite) TestInfoAPIVersioned(c *check.C) {
+	endpoint := "/v1.20/info"
+
+	status, body, err := sockRequest("GET", endpoint, nil)
+	c.Assert(status, checker.Equals, http.StatusOK)
+	c.Assert(err, checker.IsNil)
+
+	out := string(body)
+	c.Assert(out, checker.Contains, "ExecutionDriver")
+	c.Assert(out, checker.Contains, "not supported")
+}