vendor: github.com/moby/moby/api, moby/client master

full diff: e98849831f...9a97f59e6e

Signed-off-by: Sebastiaan van Stijn <github@gone.nl>
This commit is contained in:
Sebastiaan van Stijn
2025-09-29 17:37:46 +02:00
committed by Austin Vazquez
parent f8932e916b
commit cdcf267264
14 changed files with 107 additions and 37 deletions

View File

@ -3,7 +3,6 @@ package checkpoint
import (
"context"
"github.com/moby/moby/api/types/checkpoint"
"github.com/moby/moby/client"
)
@ -11,7 +10,7 @@ type fakeClient struct {
client.Client
checkpointCreateFunc func(container string, options client.CheckpointCreateOptions) error
checkpointDeleteFunc func(container string, options client.CheckpointDeleteOptions) error
checkpointListFunc func(container string, options client.CheckpointListOptions) ([]checkpoint.Summary, error)
checkpointListFunc func(container string, options client.CheckpointListOptions) (client.CheckpointListResult, error)
}
func (cli *fakeClient) CheckpointCreate(_ context.Context, container string, options client.CheckpointCreateOptions) error {
@ -28,9 +27,9 @@ func (cli *fakeClient) CheckpointDelete(_ context.Context, container string, opt
return nil
}
func (cli *fakeClient) CheckpointList(_ context.Context, container string, options client.CheckpointListOptions) ([]checkpoint.Summary, error) {
func (cli *fakeClient) CheckpointList(_ context.Context, container string, options client.CheckpointListOptions) (client.CheckpointListResult, error) {
if cli.checkpointListFunc != nil {
return cli.checkpointListFunc(container, options)
}
return []checkpoint.Summary{}, nil
return client.CheckpointListResult{}, nil
}

View File

@ -36,8 +36,8 @@ func newListCommand(dockerCLI command.Cli) *cobra.Command {
return cmd
}
func runList(ctx context.Context, dockerCli command.Cli, container string, opts listOptions) error {
checkpoints, err := dockerCli.Client().CheckpointList(ctx, container, client.CheckpointListOptions{
func runList(ctx context.Context, dockerCLI command.Cli, container string, opts listOptions) error {
checkpoints, err := dockerCLI.Client().CheckpointList(ctx, container, client.CheckpointListOptions{
CheckpointDir: opts.checkpointDir,
})
if err != nil {
@ -45,8 +45,8 @@ func runList(ctx context.Context, dockerCli command.Cli, container string, opts
}
cpCtx := formatter.Context{
Output: dockerCli.Out(),
Output: dockerCLI.Out(),
Format: newFormat(formatter.TableFormatKey),
}
return formatWrite(cpCtx, checkpoints)
return formatWrite(cpCtx, checkpoints.Checkpoints)
}

View File

@ -16,7 +16,7 @@ import (
func TestCheckpointListErrors(t *testing.T) {
testCases := []struct {
args []string
checkpointListFunc func(container string, options client.CheckpointListOptions) ([]checkpoint.Summary, error)
checkpointListFunc func(container string, options client.CheckpointListOptions) (client.CheckpointListResult, error)
expectedError string
}{
{
@ -29,8 +29,8 @@ func TestCheckpointListErrors(t *testing.T) {
},
{
args: []string{"foo"},
checkpointListFunc: func(container string, options client.CheckpointListOptions) ([]checkpoint.Summary, error) {
return []checkpoint.Summary{}, errors.New("error getting checkpoints for container foo")
checkpointListFunc: func(container string, options client.CheckpointListOptions) (client.CheckpointListResult, error) {
return client.CheckpointListResult{}, errors.New("error getting checkpoints for container foo")
},
expectedError: "error getting checkpoints for container foo",
},
@ -51,11 +51,13 @@ func TestCheckpointListErrors(t *testing.T) {
func TestCheckpointListWithOptions(t *testing.T) {
var containerID, checkpointDir string
cli := test.NewFakeCli(&fakeClient{
checkpointListFunc: func(container string, options client.CheckpointListOptions) ([]checkpoint.Summary, error) {
checkpointListFunc: func(container string, options client.CheckpointListOptions) (client.CheckpointListResult, error) {
containerID = container
checkpointDir = options.CheckpointDir
return []checkpoint.Summary{
{Name: "checkpoint-foo"},
return client.CheckpointListResult{
Checkpoints: []checkpoint.Summary{
{Name: "checkpoint-foo"},
},
}, nil
},
})