Skip to content

Commit 68fc942

Browse files
authored
Merge pull request docker#6232 from thaJeztah/bump_engine
vendor: moby/moby/api v1.52.0-alpha.1, moby/moby/client v0.1.0-alpha.0
2 parents b01d359 + f9431e3 commit 68fc942

File tree

85 files changed

+590
-422
lines changed

Some content is hidden

Large Commits have some content hidden by default. Use the searchbox below for content that may be hidden.

85 files changed

+590
-422
lines changed

cli/command/container/run_test.go

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -239,7 +239,7 @@ func TestRunPullTermination(t *testing.T) {
239239
return client.HijackedResponse{}, errors.New("shouldn't try to attach to a container")
240240
},
241241
imageCreateFunc: func(ctx context.Context, parentReference string, options image.CreateOptions) (io.ReadCloser, error) {
242-
server, client := net.Pipe()
242+
server, respReader := net.Pipe()
243243
t.Cleanup(func() {
244244
_ = server.Close()
245245
})
@@ -269,7 +269,7 @@ func TestRunPullTermination(t *testing.T) {
269269
}
270270
}()
271271
attachCh <- struct{}{}
272-
return client, nil
272+
return respReader, nil
273273
},
274274
Version: "1.30",
275275
})

cli/command/plugin/client_test.go

Lines changed: 6 additions & 6 deletions
Original file line numberDiff line numberDiff line change
@@ -4,8 +4,8 @@ import (
44
"context"
55
"io"
66

7-
"github.com/moby/moby/api/types"
87
"github.com/moby/moby/api/types/filters"
8+
"github.com/moby/moby/api/types/plugin"
99
"github.com/moby/moby/api/types/system"
1010
"github.com/moby/moby/client"
1111
)
@@ -17,8 +17,8 @@ type fakeClient struct {
1717
pluginEnableFunc func(name string, options client.PluginEnableOptions) error
1818
pluginRemoveFunc func(name string, options client.PluginRemoveOptions) error
1919
pluginInstallFunc func(name string, options client.PluginInstallOptions) (io.ReadCloser, error)
20-
pluginListFunc func(filter filters.Args) (types.PluginsListResponse, error)
21-
pluginInspectFunc func(name string) (*types.Plugin, []byte, error)
20+
pluginListFunc func(filter filters.Args) (plugin.ListResponse, error)
21+
pluginInspectFunc func(name string) (*plugin.Plugin, []byte, error)
2222
pluginUpgradeFunc func(name string, options client.PluginInstallOptions) (io.ReadCloser, error)
2323
}
2424

@@ -57,15 +57,15 @@ func (c *fakeClient) PluginInstall(_ context.Context, name string, installOption
5757
return nil, nil
5858
}
5959

60-
func (c *fakeClient) PluginList(_ context.Context, filter filters.Args) (types.PluginsListResponse, error) {
60+
func (c *fakeClient) PluginList(_ context.Context, filter filters.Args) (plugin.ListResponse, error) {
6161
if c.pluginListFunc != nil {
6262
return c.pluginListFunc(filter)
6363
}
6464

65-
return types.PluginsListResponse{}, nil
65+
return plugin.ListResponse{}, nil
6666
}
6767

68-
func (c *fakeClient) PluginInspectWithRaw(_ context.Context, name string) (*types.Plugin, []byte, error) {
68+
func (c *fakeClient) PluginInspectWithRaw(_ context.Context, name string) (*plugin.Plugin, []byte, error) {
6969
if c.pluginInspectFunc != nil {
7070
return c.pluginInspectFunc(name)
7171
}

cli/command/plugin/create.go

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -13,7 +13,7 @@ import (
1313
"github.com/docker/cli/cli/command/completion"
1414
"github.com/moby/go-archive"
1515
"github.com/moby/go-archive/compression"
16-
"github.com/moby/moby/api/types"
16+
"github.com/moby/moby/api/types/plugin"
1717
"github.com/moby/moby/client"
1818
"github.com/pkg/errors"
1919
"github.com/sirupsen/logrus"
@@ -34,7 +34,7 @@ func validateConfig(path string) error {
3434
return err
3535
}
3636

37-
m := types.PluginConfig{}
37+
m := plugin.Config{}
3838
err = json.NewDecoder(dt).Decode(&m)
3939
_ = dt.Close()
4040

cli/command/plugin/formatter.go

Lines changed: 5 additions & 5 deletions
Original file line numberDiff line numberDiff line change
@@ -4,7 +4,7 @@ import (
44
"strings"
55

66
"github.com/docker/cli/cli/command/formatter"
7-
"github.com/moby/moby/api/types"
7+
"github.com/moby/moby/api/types/plugin"
88
)
99

1010
const (
@@ -38,10 +38,10 @@ func NewFormat(source string, quiet bool) formatter.Format {
3838
}
3939

4040
// FormatWrite writes the context
41-
func FormatWrite(ctx formatter.Context, plugins []*types.Plugin) error {
41+
func FormatWrite(ctx formatter.Context, plugins []*plugin.Plugin) error {
4242
render := func(format func(subContext formatter.SubContext) error) error {
43-
for _, plugin := range plugins {
44-
pluginCtx := &pluginContext{trunc: ctx.Trunc, p: *plugin}
43+
for _, p := range plugins {
44+
pluginCtx := &pluginContext{trunc: ctx.Trunc, p: *p}
4545
if err := format(pluginCtx); err != nil {
4646
return err
4747
}
@@ -62,7 +62,7 @@ func FormatWrite(ctx formatter.Context, plugins []*types.Plugin) error {
6262
type pluginContext struct {
6363
formatter.HeaderContext
6464
trunc bool
65-
p types.Plugin
65+
p plugin.Plugin
6666
}
6767

6868
func (c *pluginContext) MarshalJSON() ([]byte, error) {

cli/command/plugin/formatter_test.go

Lines changed: 10 additions & 10 deletions
Original file line numberDiff line numberDiff line change
@@ -11,7 +11,7 @@ import (
1111

1212
"github.com/docker/cli/cli/command/formatter"
1313
"github.com/docker/cli/internal/test"
14-
"github.com/moby/moby/api/types"
14+
"github.com/moby/moby/api/types/plugin"
1515
"gotest.tools/v3/assert"
1616
is "gotest.tools/v3/assert/cmp"
1717
)
@@ -27,30 +27,30 @@ func TestPluginContext(t *testing.T) {
2727
}{
2828
{
2929
pluginCtx: pluginContext{
30-
p: types.Plugin{ID: pluginID},
30+
p: plugin.Plugin{ID: pluginID},
3131
trunc: false,
3232
},
3333
expValue: pluginID,
3434
call: pCtx.ID,
3535
},
3636
{
3737
pluginCtx: pluginContext{
38-
p: types.Plugin{ID: pluginID},
38+
p: plugin.Plugin{ID: pluginID},
3939
trunc: true,
4040
},
4141
expValue: formatter.TruncateID(pluginID),
4242
call: pCtx.ID,
4343
},
4444
{
4545
pluginCtx: pluginContext{
46-
p: types.Plugin{Name: "plugin_name"},
46+
p: plugin.Plugin{Name: "plugin_name"},
4747
},
4848
expValue: "plugin_name",
4949
call: pCtx.Name,
5050
},
5151
{
5252
pluginCtx: pluginContext{
53-
p: types.Plugin{Config: types.PluginConfig{Description: "plugin_description"}},
53+
p: plugin.Plugin{Config: plugin.Config{Description: "plugin_description"}},
5454
},
5555
expValue: "plugin_description",
5656
call: pCtx.Description,
@@ -146,9 +146,9 @@ foobar_bar
146146
},
147147
}
148148

149-
plugins := []*types.Plugin{
150-
{ID: "pluginID1", Name: "foobar_baz", Config: types.PluginConfig{Description: "description 1"}, Enabled: true},
151-
{ID: "pluginID2", Name: "foobar_bar", Config: types.PluginConfig{Description: "description 2"}, Enabled: false},
149+
plugins := []*plugin.Plugin{
150+
{ID: "pluginID1", Name: "foobar_baz", Config: plugin.Config{Description: "description 1"}, Enabled: true},
151+
{ID: "pluginID2", Name: "foobar_bar", Config: plugin.Config{Description: "description 2"}, Enabled: false},
152152
}
153153

154154
for _, tc := range tests {
@@ -167,7 +167,7 @@ foobar_bar
167167
}
168168

169169
func TestPluginContextWriteJSON(t *testing.T) {
170-
plugins := []*types.Plugin{
170+
plugins := []*plugin.Plugin{
171171
{ID: "pluginID1", Name: "foobar_baz"},
172172
{ID: "pluginID2", Name: "foobar_bar"},
173173
}
@@ -191,7 +191,7 @@ func TestPluginContextWriteJSON(t *testing.T) {
191191
}
192192

193193
func TestPluginContextWriteJSONField(t *testing.T) {
194-
plugins := []*types.Plugin{
194+
plugins := []*plugin.Plugin{
195195
{ID: "pluginID1", Name: "foobar_baz"},
196196
{ID: "pluginID2", Name: "foobar_bar"},
197197
}

cli/command/plugin/inspect_test.go

Lines changed: 15 additions & 15 deletions
Original file line numberDiff line numberDiff line change
@@ -7,27 +7,27 @@ import (
77
"testing"
88

99
"github.com/docker/cli/internal/test"
10-
"github.com/moby/moby/api/types"
10+
"github.com/moby/moby/api/types/plugin"
1111
"gotest.tools/v3/assert"
1212
"gotest.tools/v3/golden"
1313
)
1414

15-
var pluginFoo = &types.Plugin{
15+
var pluginFoo = &plugin.Plugin{
1616
ID: "id-foo",
1717
Name: "name-foo",
18-
Config: types.PluginConfig{
18+
Config: plugin.Config{
1919
Description: "plugin foo description",
2020
DockerVersion: "17.12.1-ce",
2121
Documentation: "plugin foo documentation",
2222
Entrypoint: []string{"/foo"},
23-
Interface: types.PluginConfigInterface{
23+
Interface: plugin.Interface{
2424
Socket: "plugin-foo.sock",
2525
},
26-
Linux: types.PluginConfigLinux{
26+
Linux: plugin.LinuxConfig{
2727
Capabilities: []string{"CAP_SYS_ADMIN"},
2828
},
2929
WorkDir: "workdir-foo",
30-
Rootfs: &types.PluginConfigRootfs{
30+
Rootfs: &plugin.RootFS{
3131
DiffIds: []string{"sha256:deadbeefdeadbeefdeadbeefdeadbeefdeadbeefdeadbeefdeadbeefdeadbeef"},
3232
Type: "layers",
3333
},
@@ -40,7 +40,7 @@ func TestInspectErrors(t *testing.T) {
4040
args []string
4141
flags map[string]string
4242
expectedError string
43-
inspectFunc func(name string) (*types.Plugin, []byte, error)
43+
inspectFunc func(name string) (*plugin.Plugin, []byte, error)
4444
}{
4545
{
4646
description: "too few arguments",
@@ -51,7 +51,7 @@ func TestInspectErrors(t *testing.T) {
5151
description: "error inspecting plugin",
5252
args: []string{"foo"},
5353
expectedError: "error inspecting plugin",
54-
inspectFunc: func(name string) (*types.Plugin, []byte, error) {
54+
inspectFunc: func(name string) (*plugin.Plugin, []byte, error) {
5555
return nil, nil, errors.New("error inspecting plugin")
5656
},
5757
},
@@ -86,7 +86,7 @@ func TestInspect(t *testing.T) {
8686
args []string
8787
flags map[string]string
8888
golden string
89-
inspectFunc func(name string) (*types.Plugin, []byte, error)
89+
inspectFunc func(name string) (*plugin.Plugin, []byte, error)
9090
}{
9191
{
9292
description: "inspect single plugin with format",
@@ -95,8 +95,8 @@ func TestInspect(t *testing.T) {
9595
"format": "{{ .Name }}",
9696
},
9797
golden: "plugin-inspect-single-with-format.golden",
98-
inspectFunc: func(name string) (*types.Plugin, []byte, error) {
99-
return &types.Plugin{
98+
inspectFunc: func(name string) (*plugin.Plugin, []byte, error) {
99+
return &plugin.Plugin{
100100
ID: "id-foo",
101101
Name: "name-foo",
102102
}, []byte{}, nil
@@ -106,7 +106,7 @@ func TestInspect(t *testing.T) {
106106
description: "inspect single plugin without format",
107107
args: []string{"foo"},
108108
golden: "plugin-inspect-single-without-format.golden",
109-
inspectFunc: func(name string) (*types.Plugin, []byte, error) {
109+
inspectFunc: func(name string) (*plugin.Plugin, []byte, error) {
110110
return pluginFoo, nil, nil
111111
},
112112
},
@@ -117,15 +117,15 @@ func TestInspect(t *testing.T) {
117117
"format": "{{ .Name }}",
118118
},
119119
golden: "plugin-inspect-multiple-with-format.golden",
120-
inspectFunc: func(name string) (*types.Plugin, []byte, error) {
120+
inspectFunc: func(name string) (*plugin.Plugin, []byte, error) {
121121
switch name {
122122
case "foo":
123-
return &types.Plugin{
123+
return &plugin.Plugin{
124124
ID: "id-foo",
125125
Name: "name-foo",
126126
}, []byte{}, nil
127127
case "bar":
128-
return &types.Plugin{
128+
return &plugin.Plugin{
129129
ID: "id-bar",
130130
Name: "name-bar",
131131
}, []byte{}, nil

cli/command/plugin/install.go

Lines changed: 3 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -12,7 +12,7 @@ import (
1212
"github.com/docker/cli/internal/jsonstream"
1313
"github.com/docker/cli/internal/prompt"
1414
"github.com/docker/cli/internal/registry"
15-
"github.com/moby/moby/api/types"
15+
"github.com/moby/moby/api/types/plugin"
1616
registrytypes "github.com/moby/moby/api/types/registry"
1717
"github.com/moby/moby/client"
1818
"github.com/pkg/errors"
@@ -136,8 +136,8 @@ func runInstall(ctx context.Context, dockerCLI command.Cli, opts pluginOptions)
136136
return nil
137137
}
138138

139-
func acceptPrivileges(dockerCLI command.Streams, name string) func(ctx context.Context, privileges types.PluginPrivileges) (bool, error) {
140-
return func(ctx context.Context, privileges types.PluginPrivileges) (bool, error) {
139+
func acceptPrivileges(dockerCLI command.Streams, name string) func(ctx context.Context, privileges plugin.Privileges) (bool, error) {
140+
return func(ctx context.Context, privileges plugin.Privileges) (bool, error) {
141141
_, _ = fmt.Fprintf(dockerCLI.Out(), "Plugin %q is requesting the following privileges:\n", name)
142142
for _, privilege := range privileges {
143143
_, _ = fmt.Fprintf(dockerCLI.Out(), " - %s: %v\n", privilege.Name, privilege.Value)

cli/command/plugin/list_test.go

Lines changed: 14 additions & 14 deletions
Original file line numberDiff line numberDiff line change
@@ -6,8 +6,8 @@ import (
66
"testing"
77

88
"github.com/docker/cli/internal/test"
9-
"github.com/moby/moby/api/types"
109
"github.com/moby/moby/api/types/filters"
10+
"github.com/moby/moby/api/types/plugin"
1111

1212
"gotest.tools/v3/assert"
1313
is "gotest.tools/v3/assert/cmp"
@@ -20,7 +20,7 @@ func TestListErrors(t *testing.T) {
2020
args []string
2121
flags map[string]string
2222
expectedError string
23-
listFunc func(filter filters.Args) (types.PluginsListResponse, error)
23+
listFunc func(filter filters.Args) (plugin.ListResponse, error)
2424
}{
2525
{
2626
description: "too many arguments",
@@ -31,8 +31,8 @@ func TestListErrors(t *testing.T) {
3131
description: "error listing plugins",
3232
args: []string{},
3333
expectedError: "error listing plugins",
34-
listFunc: func(filter filters.Args) (types.PluginsListResponse, error) {
35-
return types.PluginsListResponse{}, errors.New("error listing plugins")
34+
listFunc: func(filter filters.Args) (plugin.ListResponse, error) {
35+
return plugin.ListResponse{}, errors.New("error listing plugins")
3636
},
3737
},
3838
{
@@ -61,13 +61,13 @@ func TestListErrors(t *testing.T) {
6161
}
6262

6363
func TestList(t *testing.T) {
64-
singlePluginListFunc := func(_ filters.Args) (types.PluginsListResponse, error) {
65-
return types.PluginsListResponse{
64+
singlePluginListFunc := func(_ filters.Args) (plugin.ListResponse, error) {
65+
return plugin.ListResponse{
6666
{
6767
ID: "id-foo",
6868
Name: "name-foo",
6969
Enabled: true,
70-
Config: types.PluginConfig{
70+
Config: plugin.Config{
7171
Description: "desc-bar",
7272
},
7373
},
@@ -79,7 +79,7 @@ func TestList(t *testing.T) {
7979
args []string
8080
flags map[string]string
8181
golden string
82-
listFunc func(filter filters.Args) (types.PluginsListResponse, error)
82+
listFunc func(filter filters.Args) (plugin.ListResponse, error)
8383
}{
8484
{
8585
description: "list with no additional flags",
@@ -94,7 +94,7 @@ func TestList(t *testing.T) {
9494
"filter": "foo=bar",
9595
},
9696
golden: "plugin-list-without-format.golden",
97-
listFunc: func(filter filters.Args) (types.PluginsListResponse, error) {
97+
listFunc: func(filter filters.Args) (plugin.ListResponse, error) {
9898
assert.Check(t, is.Equal("bar", filter.Get("foo")[0]))
9999
return singlePluginListFunc(filter)
100100
},
@@ -116,13 +116,13 @@ func TestList(t *testing.T) {
116116
"format": "{{ .ID }}",
117117
},
118118
golden: "plugin-list-with-no-trunc-option.golden",
119-
listFunc: func(_ filters.Args) (types.PluginsListResponse, error) {
120-
return types.PluginsListResponse{
119+
listFunc: func(_ filters.Args) (plugin.ListResponse, error) {
120+
return plugin.ListResponse{
121121
{
122122
ID: "xyg4z2hiSLO5yTnBJfg4OYia9gKA6Qjd",
123123
Name: "name-foo",
124124
Enabled: true,
125-
Config: types.PluginConfig{
125+
Config: plugin.Config{
126126
Description: "desc-bar",
127127
},
128128
},
@@ -145,8 +145,8 @@ func TestList(t *testing.T) {
145145
"format": "{{ .Name }}",
146146
},
147147
golden: "plugin-list-sort.golden",
148-
listFunc: func(_ filters.Args) (types.PluginsListResponse, error) {
149-
return types.PluginsListResponse{
148+
listFunc: func(_ filters.Args) (plugin.ListResponse, error) {
149+
return plugin.ListResponse{
150150
{
151151
ID: "id-1",
152152
Name: "plugin-1-foo",

0 commit comments

Comments
 (0)