Skip to content

Commit 4df42ef

Browse files
authored
Merge pull request #6395 from thaJeztah/bump_engine
vendor: github.com/moby/moby/api v1.52.0-beta.1, client v0.1.0-beta.0
2 parents 9fb049c + b55fed5 commit 4df42ef

File tree

110 files changed

+1038
-775
lines changed

Some content is hidden

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

110 files changed

+1038
-775
lines changed

cli/command/builder/client_test.go

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -9,10 +9,10 @@ import (
99

1010
type fakeClient struct {
1111
client.Client
12-
builderPruneFunc func(ctx context.Context, opts build.CachePruneOptions) (*build.CachePruneReport, error)
12+
builderPruneFunc func(ctx context.Context, opts client.BuildCachePruneOptions) (*build.CachePruneReport, error)
1313
}
1414

15-
func (c *fakeClient) BuildCachePrune(ctx context.Context, opts build.CachePruneOptions) (*build.CachePruneReport, error) {
15+
func (c *fakeClient) BuildCachePrune(ctx context.Context, opts client.BuildCachePruneOptions) (*build.CachePruneReport, error) {
1616
if c.builderPruneFunc != nil {
1717
return c.builderPruneFunc(ctx, opts)
1818
}

cli/command/builder/prune.go

Lines changed: 9 additions & 12 deletions
Original file line numberDiff line numberDiff line change
@@ -12,8 +12,8 @@ import (
1212
"github.com/docker/cli/internal/prompt"
1313
"github.com/docker/cli/opts"
1414
"github.com/docker/go-units"
15-
"github.com/moby/moby/api/types/build"
1615
"github.com/moby/moby/api/types/versions"
16+
"github.com/moby/moby/client"
1717
"github.com/spf13/cobra"
1818
)
1919

@@ -25,10 +25,10 @@ func init() {
2525
}
2626

2727
type pruneOptions struct {
28-
force bool
29-
all bool
30-
filter opts.FilterOpt
31-
keepStorage opts.MemBytes
28+
force bool
29+
all bool
30+
filter opts.FilterOpt
31+
reservedSpace opts.MemBytes
3232
}
3333

3434
// newPruneCommand returns a new cobra prune command for images
@@ -59,7 +59,7 @@ func newPruneCommand(dockerCLI command.Cli) *cobra.Command {
5959
flags.BoolVarP(&options.force, "force", "f", false, "Do not prompt for confirmation")
6060
flags.BoolVarP(&options.all, "all", "a", false, "Remove all unused build cache, not just dangling ones")
6161
flags.Var(&options.filter, "filter", `Provide filter values (e.g. "until=24h")`)
62-
flags.Var(&options.keepStorage, "keep-storage", "Amount of disk space to keep for cache")
62+
flags.Var(&options.reservedSpace, "keep-storage", "Amount of disk space to keep for cache")
6363

6464
return cmd
6565
}
@@ -87,12 +87,9 @@ func runPrune(ctx context.Context, dockerCli command.Cli, options pruneOptions)
8787
}
8888
}
8989

90-
report, err := dockerCli.Client().BuildCachePrune(ctx, build.CachePruneOptions{
91-
All: options.all,
92-
// TODO(austinvazquez): remove when updated to use github.com/moby/moby/[email protected]
93-
// See https://github.com/moby/moby/pull/50772 for more details.
94-
KeepStorage: options.keepStorage.Value(),
95-
ReservedSpace: options.keepStorage.Value(),
90+
report, err := dockerCli.Client().BuildCachePrune(ctx, client.BuildCachePruneOptions{
91+
All: options.all,
92+
ReservedSpace: options.reservedSpace.Value(),
9693
Filters: pruneFilters,
9794
})
9895
if err != nil {

cli/command/builder/prune_test.go

Lines changed: 2 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -8,14 +8,15 @@ import (
88

99
"github.com/docker/cli/internal/test"
1010
"github.com/moby/moby/api/types/build"
11+
"github.com/moby/moby/client"
1112
)
1213

1314
func TestBuilderPromptTermination(t *testing.T) {
1415
ctx, cancel := context.WithCancel(context.Background())
1516
t.Cleanup(cancel)
1617

1718
cli := test.NewFakeCli(&fakeClient{
18-
builderPruneFunc: func(ctx context.Context, opts build.CachePruneOptions) (*build.CachePruneReport, error) {
19+
builderPruneFunc: func(ctx context.Context, opts client.BuildCachePruneOptions) (*build.CachePruneReport, error) {
1920
return nil, errors.New("fakeClient builderPruneFunc should not be called")
2021
},
2122
})

cli/command/checkpoint/client_test.go

Lines changed: 6 additions & 6 deletions
Original file line numberDiff line numberDiff line change
@@ -9,26 +9,26 @@ import (
99

1010
type fakeClient struct {
1111
client.Client
12-
checkpointCreateFunc func(container string, options checkpoint.CreateOptions) error
13-
checkpointDeleteFunc func(container string, options checkpoint.DeleteOptions) error
14-
checkpointListFunc func(container string, options checkpoint.ListOptions) ([]checkpoint.Summary, error)
12+
checkpointCreateFunc func(container string, options client.CheckpointCreateOptions) error
13+
checkpointDeleteFunc func(container string, options client.CheckpointDeleteOptions) error
14+
checkpointListFunc func(container string, options client.CheckpointListOptions) ([]checkpoint.Summary, error)
1515
}
1616

17-
func (cli *fakeClient) CheckpointCreate(_ context.Context, container string, options checkpoint.CreateOptions) error {
17+
func (cli *fakeClient) CheckpointCreate(_ context.Context, container string, options client.CheckpointCreateOptions) error {
1818
if cli.checkpointCreateFunc != nil {
1919
return cli.checkpointCreateFunc(container, options)
2020
}
2121
return nil
2222
}
2323

24-
func (cli *fakeClient) CheckpointDelete(_ context.Context, container string, options checkpoint.DeleteOptions) error {
24+
func (cli *fakeClient) CheckpointDelete(_ context.Context, container string, options client.CheckpointDeleteOptions) error {
2525
if cli.checkpointDeleteFunc != nil {
2626
return cli.checkpointDeleteFunc(container, options)
2727
}
2828
return nil
2929
}
3030

31-
func (cli *fakeClient) CheckpointList(_ context.Context, container string, options checkpoint.ListOptions) ([]checkpoint.Summary, error) {
31+
func (cli *fakeClient) CheckpointList(_ context.Context, container string, options client.CheckpointListOptions) ([]checkpoint.Summary, error) {
3232
if cli.checkpointListFunc != nil {
3333
return cli.checkpointListFunc(container, options)
3434
}

cli/command/checkpoint/create.go

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -6,7 +6,7 @@ import (
66

77
"github.com/docker/cli/cli"
88
"github.com/docker/cli/cli/command"
9-
"github.com/moby/moby/api/types/checkpoint"
9+
"github.com/moby/moby/client"
1010
"github.com/spf13/cobra"
1111
)
1212

@@ -41,7 +41,7 @@ func newCreateCommand(dockerCLI command.Cli) *cobra.Command {
4141
}
4242

4343
func runCreate(ctx context.Context, dockerCLI command.Cli, opts createOptions) error {
44-
err := dockerCLI.Client().CheckpointCreate(ctx, opts.container, checkpoint.CreateOptions{
44+
err := dockerCLI.Client().CheckpointCreate(ctx, opts.container, client.CheckpointCreateOptions{
4545
CheckpointID: opts.checkpoint,
4646
CheckpointDir: opts.checkpointDir,
4747
Exit: !opts.leaveRunning,

cli/command/checkpoint/create_test.go

Lines changed: 6 additions & 6 deletions
Original file line numberDiff line numberDiff line change
@@ -8,15 +8,15 @@ import (
88
"testing"
99

1010
"github.com/docker/cli/internal/test"
11-
"github.com/moby/moby/api/types/checkpoint"
11+
"github.com/moby/moby/client"
1212
"gotest.tools/v3/assert"
1313
is "gotest.tools/v3/assert/cmp"
1414
)
1515

1616
func TestCheckpointCreateErrors(t *testing.T) {
1717
testCases := []struct {
1818
args []string
19-
checkpointCreateFunc func(container string, options checkpoint.CreateOptions) error
19+
checkpointCreateFunc func(container string, options client.CheckpointCreateOptions) error
2020
expectedError string
2121
}{
2222
{
@@ -29,7 +29,7 @@ func TestCheckpointCreateErrors(t *testing.T) {
2929
},
3030
{
3131
args: []string{"foo", "bar"},
32-
checkpointCreateFunc: func(container string, options checkpoint.CreateOptions) error {
32+
checkpointCreateFunc: func(container string, options client.CheckpointCreateOptions) error {
3333
return errors.New("error creating checkpoint for container foo")
3434
},
3535
expectedError: "error creating checkpoint for container foo",
@@ -59,9 +59,9 @@ func TestCheckpointCreateWithOptions(t *testing.T) {
5959
leaveRunning := strconv.FormatBool(tc)
6060
t.Run("leave-running="+leaveRunning, func(t *testing.T) {
6161
var actualContainerName string
62-
var actualOptions checkpoint.CreateOptions
62+
var actualOptions client.CheckpointCreateOptions
6363
cli := test.NewFakeCli(&fakeClient{
64-
checkpointCreateFunc: func(container string, options checkpoint.CreateOptions) error {
64+
checkpointCreateFunc: func(container string, options client.CheckpointCreateOptions) error {
6565
actualContainerName = container
6666
actualOptions = options
6767
return nil
@@ -75,7 +75,7 @@ func TestCheckpointCreateWithOptions(t *testing.T) {
7575
assert.Check(t, cmd.Flags().Set("checkpoint-dir", checkpointDir))
7676
assert.NilError(t, cmd.Execute())
7777
assert.Check(t, is.Equal(actualContainerName, containerName))
78-
expected := checkpoint.CreateOptions{
78+
expected := client.CheckpointCreateOptions{
7979
CheckpointID: checkpointName,
8080
CheckpointDir: checkpointDir,
8181
Exit: !tc,

cli/command/checkpoint/list.go

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -7,7 +7,7 @@ import (
77
"github.com/docker/cli/cli/command"
88
"github.com/docker/cli/cli/command/completion"
99
"github.com/docker/cli/cli/command/formatter"
10-
"github.com/moby/moby/api/types/checkpoint"
10+
"github.com/moby/moby/client"
1111
"github.com/spf13/cobra"
1212
)
1313

@@ -37,7 +37,7 @@ func newListCommand(dockerCLI command.Cli) *cobra.Command {
3737
}
3838

3939
func runList(ctx context.Context, dockerCli command.Cli, container string, opts listOptions) error {
40-
checkpoints, err := dockerCli.Client().CheckpointList(ctx, container, checkpoint.ListOptions{
40+
checkpoints, err := dockerCli.Client().CheckpointList(ctx, container, client.CheckpointListOptions{
4141
CheckpointDir: opts.checkpointDir,
4242
})
4343
if err != nil {

cli/command/checkpoint/list_test.go

Lines changed: 4 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -7,6 +7,7 @@ import (
77

88
"github.com/docker/cli/internal/test"
99
"github.com/moby/moby/api/types/checkpoint"
10+
"github.com/moby/moby/client"
1011
"gotest.tools/v3/assert"
1112
is "gotest.tools/v3/assert/cmp"
1213
"gotest.tools/v3/golden"
@@ -15,7 +16,7 @@ import (
1516
func TestCheckpointListErrors(t *testing.T) {
1617
testCases := []struct {
1718
args []string
18-
checkpointListFunc func(container string, options checkpoint.ListOptions) ([]checkpoint.Summary, error)
19+
checkpointListFunc func(container string, options client.CheckpointListOptions) ([]checkpoint.Summary, error)
1920
expectedError string
2021
}{
2122
{
@@ -28,7 +29,7 @@ func TestCheckpointListErrors(t *testing.T) {
2829
},
2930
{
3031
args: []string{"foo"},
31-
checkpointListFunc: func(container string, options checkpoint.ListOptions) ([]checkpoint.Summary, error) {
32+
checkpointListFunc: func(container string, options client.CheckpointListOptions) ([]checkpoint.Summary, error) {
3233
return []checkpoint.Summary{}, errors.New("error getting checkpoints for container foo")
3334
},
3435
expectedError: "error getting checkpoints for container foo",
@@ -50,7 +51,7 @@ func TestCheckpointListErrors(t *testing.T) {
5051
func TestCheckpointListWithOptions(t *testing.T) {
5152
var containerID, checkpointDir string
5253
cli := test.NewFakeCli(&fakeClient{
53-
checkpointListFunc: func(container string, options checkpoint.ListOptions) ([]checkpoint.Summary, error) {
54+
checkpointListFunc: func(container string, options client.CheckpointListOptions) ([]checkpoint.Summary, error) {
5455
containerID = container
5556
checkpointDir = options.CheckpointDir
5657
return []checkpoint.Summary{

cli/command/checkpoint/remove.go

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

66
"github.com/docker/cli/cli"
77
"github.com/docker/cli/cli/command"
8-
"github.com/moby/moby/api/types/checkpoint"
8+
"github.com/moby/moby/client"
99
"github.com/spf13/cobra"
1010
)
1111

@@ -34,7 +34,7 @@ func newRemoveCommand(dockerCLI command.Cli) *cobra.Command {
3434
}
3535

3636
func runRemove(ctx context.Context, dockerCli command.Cli, container string, checkpointID string, opts removeOptions) error {
37-
return dockerCli.Client().CheckpointDelete(ctx, container, checkpoint.DeleteOptions{
37+
return dockerCli.Client().CheckpointDelete(ctx, container, client.CheckpointDeleteOptions{
3838
CheckpointID: checkpointID,
3939
CheckpointDir: opts.checkpointDir,
4040
})

cli/command/checkpoint/remove_test.go

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

88
"github.com/docker/cli/internal/test"
9-
"github.com/moby/moby/api/types/checkpoint"
9+
"github.com/moby/moby/client"
1010
"gotest.tools/v3/assert"
1111
is "gotest.tools/v3/assert/cmp"
1212
)
1313

1414
func TestCheckpointRemoveErrors(t *testing.T) {
1515
testCases := []struct {
1616
args []string
17-
checkpointDeleteFunc func(container string, options checkpoint.DeleteOptions) error
17+
checkpointDeleteFunc func(container string, options client.CheckpointDeleteOptions) error
1818
expectedError string
1919
}{
2020
{
@@ -27,7 +27,7 @@ func TestCheckpointRemoveErrors(t *testing.T) {
2727
},
2828
{
2929
args: []string{"foo", "bar"},
30-
checkpointDeleteFunc: func(container string, options checkpoint.DeleteOptions) error {
30+
checkpointDeleteFunc: func(container string, options client.CheckpointDeleteOptions) error {
3131
return errors.New("error deleting checkpoint")
3232
},
3333
expectedError: "error deleting checkpoint",
@@ -49,7 +49,7 @@ func TestCheckpointRemoveErrors(t *testing.T) {
4949
func TestCheckpointRemoveWithOptions(t *testing.T) {
5050
var containerID, checkpointID, checkpointDir string
5151
cli := test.NewFakeCli(&fakeClient{
52-
checkpointDeleteFunc: func(container string, options checkpoint.DeleteOptions) error {
52+
checkpointDeleteFunc: func(container string, options client.CheckpointDeleteOptions) error {
5353
containerID = container
5454
checkpointID = options.CheckpointID
5555
checkpointDir = options.CheckpointDir

0 commit comments

Comments
 (0)