mirror of
https://github.com/moby/moby.git
synced 2026-01-11 02:31:44 +00:00
client: CheckpointListResult: rename Checkpoints to Items
Align with other ListResult structs Signed-off-by: Sebastiaan van Stijn <github@gone.nl>
This commit is contained in:
@@ -15,7 +15,7 @@ type CheckpointListOptions struct {
|
||||
|
||||
// CheckpointListResult holds the result from the CheckpointList method.
|
||||
type CheckpointListResult struct {
|
||||
Checkpoints []checkpoint.Summary
|
||||
Items []checkpoint.Summary
|
||||
}
|
||||
|
||||
// CheckpointList returns the checkpoints of the given container in the docker host.
|
||||
@@ -33,6 +33,6 @@ func (cli *Client) CheckpointList(ctx context.Context, container string, options
|
||||
return out, err
|
||||
}
|
||||
|
||||
err = json.NewDecoder(resp.Body).Decode(&out.Checkpoints)
|
||||
err = json.NewDecoder(resp.Body).Decode(&out.Items)
|
||||
return out, err
|
||||
}
|
||||
|
||||
@@ -1,7 +1,6 @@
|
||||
package client
|
||||
|
||||
import (
|
||||
"context"
|
||||
"net/http"
|
||||
"testing"
|
||||
|
||||
@@ -17,7 +16,7 @@ func TestCheckpointListError(t *testing.T) {
|
||||
)
|
||||
assert.NilError(t, err)
|
||||
|
||||
_, err = client.CheckpointList(context.Background(), "container_id", CheckpointListOptions{})
|
||||
_, err = client.CheckpointList(t.Context(), "container_id", CheckpointListOptions{})
|
||||
assert.Check(t, is.ErrorType(err, cerrdefs.IsInternal))
|
||||
}
|
||||
|
||||
@@ -36,9 +35,9 @@ func TestCheckpointList(t *testing.T) {
|
||||
)
|
||||
assert.NilError(t, err)
|
||||
|
||||
res, err := client.CheckpointList(context.Background(), "container_id", CheckpointListOptions{})
|
||||
res, err := client.CheckpointList(t.Context(), "container_id", CheckpointListOptions{})
|
||||
assert.NilError(t, err)
|
||||
assert.Check(t, is.Len(res.Checkpoints, 1))
|
||||
assert.Check(t, is.Len(res.Items, 1))
|
||||
}
|
||||
|
||||
func TestCheckpointListContainerNotFound(t *testing.T) {
|
||||
@@ -47,6 +46,6 @@ func TestCheckpointListContainerNotFound(t *testing.T) {
|
||||
)
|
||||
assert.NilError(t, err)
|
||||
|
||||
_, err = client.CheckpointList(context.Background(), "unknown", CheckpointListOptions{})
|
||||
_, err = client.CheckpointList(t.Context(), "unknown", CheckpointListOptions{})
|
||||
assert.Check(t, is.ErrorType(err, cerrdefs.IsNotFound))
|
||||
}
|
||||
|
||||
@@ -79,8 +79,8 @@ func TestCheckpoint(t *testing.T) {
|
||||
|
||||
res, err := apiClient.CheckpointList(ctx, cID, client.CheckpointListOptions{})
|
||||
assert.NilError(t, err)
|
||||
assert.Equal(t, len(res.Checkpoints), 1)
|
||||
assert.Equal(t, res.Checkpoints[0].Name, "test")
|
||||
assert.Equal(t, len(res.Items), 1)
|
||||
assert.Equal(t, res.Items[0].Name, "test")
|
||||
|
||||
// Create a test file on a tmpfs mount.
|
||||
cmd := []string{"touch", "/tmp/test-file"}
|
||||
@@ -105,9 +105,9 @@ func TestCheckpoint(t *testing.T) {
|
||||
// Check that both checkpoints are listed.
|
||||
res, err = apiClient.CheckpointList(ctx, cID, client.CheckpointListOptions{})
|
||||
assert.NilError(t, err)
|
||||
assert.Equal(t, len(res.Checkpoints), 2)
|
||||
assert.Equal(t, len(res.Items), 2)
|
||||
cptNames := make([]string, 2)
|
||||
for i, c := range res.Checkpoints {
|
||||
for i, c := range res.Items {
|
||||
cptNames[i] = c.Name
|
||||
}
|
||||
sort.Strings(cptNames)
|
||||
|
||||
4
vendor/github.com/moby/moby/client/checkpoint_list.go
generated
vendored
4
vendor/github.com/moby/moby/client/checkpoint_list.go
generated
vendored
@@ -15,7 +15,7 @@ type CheckpointListOptions struct {
|
||||
|
||||
// CheckpointListResult holds the result from the CheckpointList method.
|
||||
type CheckpointListResult struct {
|
||||
Checkpoints []checkpoint.Summary
|
||||
Items []checkpoint.Summary
|
||||
}
|
||||
|
||||
// CheckpointList returns the checkpoints of the given container in the docker host.
|
||||
@@ -33,6 +33,6 @@ func (cli *Client) CheckpointList(ctx context.Context, container string, options
|
||||
return out, err
|
||||
}
|
||||
|
||||
err = json.NewDecoder(resp.Body).Decode(&out.Checkpoints)
|
||||
err = json.NewDecoder(resp.Body).Decode(&out.Items)
|
||||
return out, err
|
||||
}
|
||||
|
||||
Reference in New Issue
Block a user