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:
@@ -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)
|
||||
}
|
||||
}
|
||||
|
||||
|
||||
Reference in New Issue
Block a user