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

Merge pull request #31164 from vieux/missing_api_changes

add missing API changes
This commit is contained in:
Victor Vieux 2017-02-20 15:42:19 -08:00 committed by GitHub
commit f10085165a
5 changed files with 16 additions and 17 deletions

View file

@ -520,9 +520,9 @@ func (s *containerRouter) wsContainersAttach(ctx context.Context, w http.Respons
}()
conn := <-wsChan
// In case version is higher than 1.26, a binary frame will be sent.
// In case version is higher than 1.27, a binary frame will be sent.
// See 28176 for details.
if versions.GreaterThanOrEqualTo(version, "1.26") {
if versions.GreaterThanOrEqualTo(version, "1.27") {
conn.PayloadType = websocket.BinaryFrame
}
return conn, conn, conn, nil

View file

@ -60,11 +60,11 @@ SKIP:
}
var nr *types.NetworkResource
// Versions < 1.26 fetches all the containers attached to a network
// Versions < 1.27 fetches all the containers attached to a network
// in a network list api call. It is a heavy weight operation when
// run across all the networks. Starting API version 1.26, this detailed
// run across all the networks. Starting API version 1.27, this detailed
// info is available for network specific GET API (equivalent to inspect)
if versions.LessThan(httputils.VersionFromContext(ctx), "1.26") {
if versions.LessThan(httputils.VersionFromContext(ctx), "1.27") {
nr = n.buildDetailedNetworkResources(nw)
} else {
nr = n.buildNetworkResource(nw)

View file

@ -469,7 +469,7 @@ func addServiceFlags(cmd *cobra.Command, opts *serviceOptions) {
flags.SetAnnotation(flagTTY, "version", []string{"1.25"})
flags.BoolVar(&opts.readOnly, flagReadOnly, false, "Mount the container's root filesystem as read only")
flags.SetAnnotation(flagReadOnly, "version", []string{"1.26"})
flags.SetAnnotation(flagReadOnly, "version", []string{"1.27"})
}
const (

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"