2015-04-16 15:48:04 -04:00
|
|
|
package main
|
|
|
|
|
|
|
|
import (
|
|
|
|
"encoding/json"
|
2015-04-20 17:03:56 -04:00
|
|
|
"net/http"
|
2015-04-16 15:48:04 -04:00
|
|
|
|
|
|
|
"github.com/docker/docker/api/types"
|
|
|
|
"github.com/docker/docker/autogen/dockerversion"
|
2015-04-18 12:46:47 -04:00
|
|
|
"github.com/go-check/check"
|
2015-04-16 15:48:04 -04:00
|
|
|
)
|
|
|
|
|
2015-04-18 12:46:47 -04:00
|
|
|
func (s *DockerSuite) TestGetVersion(c *check.C) {
|
2015-04-20 17:03:56 -04:00
|
|
|
status, body, err := sockRequest("GET", "/version", nil)
|
|
|
|
c.Assert(status, check.Equals, http.StatusOK)
|
|
|
|
c.Assert(err, check.IsNil)
|
|
|
|
|
2015-04-16 15:48:04 -04:00
|
|
|
var v types.Version
|
|
|
|
if err := json.Unmarshal(body, &v); err != nil {
|
2015-04-18 12:46:47 -04:00
|
|
|
c.Fatal(err)
|
2015-04-16 15:48:04 -04:00
|
|
|
}
|
|
|
|
|
|
|
|
if v.Version != dockerversion.VERSION {
|
2015-04-18 12:46:47 -04:00
|
|
|
c.Fatal("Version mismatch")
|
2015-04-16 15:48:04 -04:00
|
|
|
}
|
|
|
|
}
|