1
0
Fork 0
mirror of https://github.com/moby/moby.git synced 2022-11-09 12:21:53 -05:00

Merge pull request #27630 from runcom/fix-info-route

api/server/router/system: fix info versioning
This commit is contained in:
Sebastiaan van Stijn 2016-10-21 18:58:10 -07:00 committed by GitHub
commit b54a1d83fa
2 changed files with 13 additions and 1 deletions

View file

@ -38,7 +38,7 @@ func (s *systemRouter) getInfo(ctx context.Context, w http.ResponseWriter, r *ht
info.Swarm = s.clusterProvider.Info() 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 // TODO: handle this conversion in engine-api
type oldInfo struct { type oldInfo struct {
*types.Info *types.Info

View file

@ -38,3 +38,15 @@ func (s *DockerSuite) TestInfoAPI(c *check.C) {
c.Assert(out, checker.Contains, linePrefix) 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")
}