add missing API changes

Signed-off-by: Victor Vieux <victorvieux@gmail.com>
This commit is contained in:
Victor Vieux 2017-02-19 00:43:08 -08:00
parent d5e4c0d0be
commit 0d367623d0
2 changed files with 10 additions and 11 deletions

View File

@ -53,13 +53,11 @@ import (
"path/filepath"
"strings"
"github.com/docker/docker/api"
"github.com/docker/go-connections/sockets"
"github.com/docker/go-connections/tlsconfig"
)
// DefaultVersion is the version of the current stable API
const DefaultVersion string = "1.26"
// Client is the API client that performs all operations
// against a docker server.
type Client struct {
@ -115,7 +113,7 @@ func NewEnvClient() (*Client, error) {
}
version := os.Getenv("DOCKER_API_VERSION")
if version == "" {
version = DefaultVersion
version = api.DefaultVersion
}
cli, err := NewClient(host, version, client, nil)

View File

@ -11,6 +11,7 @@ import (
"strings"
"testing"
"github.com/docker/docker/api"
"github.com/docker/docker/api/types"
"golang.org/x/net/context"
)
@ -26,7 +27,7 @@ func TestNewEnvClient(t *testing.T) {
}{
{
envs: map[string]string{},
expectedVersion: DefaultVersion,
expectedVersion: api.DefaultVersion,
},
{
envs: map[string]string{
@ -38,21 +39,21 @@ func TestNewEnvClient(t *testing.T) {
envs: map[string]string{
"DOCKER_CERT_PATH": "testdata/",
},
expectedVersion: DefaultVersion,
expectedVersion: api.DefaultVersion,
},
{
envs: map[string]string{
"DOCKER_CERT_PATH": "testdata/",
"DOCKER_TLS_VERIFY": "1",
},
expectedVersion: DefaultVersion,
expectedVersion: api.DefaultVersion,
},
{
envs: map[string]string{
"DOCKER_CERT_PATH": "testdata/",
"DOCKER_HOST": "https://notaunixsocket",
},
expectedVersion: DefaultVersion,
expectedVersion: api.DefaultVersion,
},
{
envs: map[string]string{
@ -64,7 +65,7 @@ func TestNewEnvClient(t *testing.T) {
envs: map[string]string{
"DOCKER_HOST": "invalid://url",
},
expectedVersion: DefaultVersion,
expectedVersion: api.DefaultVersion,
},
{
envs: map[string]string{
@ -262,8 +263,8 @@ func TestNewEnvClientSetsDefaultVersion(t *testing.T) {
if err != nil {
t.Fatal(err)
}
if client.version != DefaultVersion {
t.Fatalf("Expected %s, got %s", DefaultVersion, client.version)
if client.version != api.DefaultVersion {
t.Fatalf("Expected %s, got %s", api.DefaultVersion, client.version)
}
expected := "1.22"