1
0
mirror of https://github.com/moby/moby.git synced 2025-12-24 13:21:20 +03:00

Port 'docker version' to the engine API

This commit is contained in:
Solomon Hykes
2013-12-08 07:41:53 +00:00
parent 869a11bc93
commit de35b346d1
5 changed files with 25 additions and 32 deletions

View File

@@ -7,6 +7,7 @@ import (
"encoding/json"
"fmt"
"github.com/dotcloud/docker"
"github.com/dotcloud/docker/engine"
"github.com/dotcloud/docker/utils"
"io"
"net"
@@ -35,12 +36,18 @@ func TestGetVersion(t *testing.T) {
}
assertHttpNotError(r, t)
v := &docker.APIVersion{}
if err = json.Unmarshal(r.Body.Bytes(), v); err != nil {
out := engine.NewOutput()
v, err := out.AddEnv()
if err != nil {
t.Fatal(err)
}
if v.Version != docker.VERSION {
t.Errorf("Expected version %s, %s found", docker.VERSION, v.Version)
if _, err := io.Copy(out, r.Body); err != nil {
t.Fatal(err)
}
out.Close()
expected := docker.VERSION
if result := v.Get("Version"); result != expected {
t.Errorf("Expected version %s, %s found", expected, result)
}
}