Quellcode durchsuchen

Merge pull request #46335 from thaJeztah/api_move_checkpoint_types

api/types: move checkpoint-types to api/types/checkpoint
Sebastiaan van Stijn vor 1 Jahr
Ursprung
Commit
a65c948e7e

+ 4 - 4
api/server/router/checkpoint/backend.go

@@ -1,10 +1,10 @@
 package checkpoint // import "github.com/docker/docker/api/server/router/checkpoint"
 package checkpoint // import "github.com/docker/docker/api/server/router/checkpoint"
 
 
-import "github.com/docker/docker/api/types"
+import "github.com/docker/docker/api/types/checkpoint"
 
 
 // Backend for Checkpoint
 // Backend for Checkpoint
 type Backend interface {
 type Backend interface {
-	CheckpointCreate(container string, config types.CheckpointCreateOptions) error
-	CheckpointDelete(container string, config types.CheckpointDeleteOptions) error
-	CheckpointList(container string, config types.CheckpointListOptions) ([]types.Checkpoint, error)
+	CheckpointCreate(container string, config checkpoint.CreateOptions) error
+	CheckpointDelete(container string, config checkpoint.DeleteOptions) error
+	CheckpointList(container string, config checkpoint.ListOptions) ([]checkpoint.Summary, error)
 }
 }

+ 4 - 4
api/server/router/checkpoint/checkpoint_routes.go

@@ -5,7 +5,7 @@ import (
 	"net/http"
 	"net/http"
 
 
 	"github.com/docker/docker/api/server/httputils"
 	"github.com/docker/docker/api/server/httputils"
-	"github.com/docker/docker/api/types"
+	"github.com/docker/docker/api/types/checkpoint"
 )
 )
 
 
 func (s *checkpointRouter) postContainerCheckpoint(ctx context.Context, w http.ResponseWriter, r *http.Request, vars map[string]string) error {
 func (s *checkpointRouter) postContainerCheckpoint(ctx context.Context, w http.ResponseWriter, r *http.Request, vars map[string]string) error {
@@ -13,7 +13,7 @@ func (s *checkpointRouter) postContainerCheckpoint(ctx context.Context, w http.R
 		return err
 		return err
 	}
 	}
 
 
-	var options types.CheckpointCreateOptions
+	var options checkpoint.CreateOptions
 	if err := httputils.ReadJSON(r, &options); err != nil {
 	if err := httputils.ReadJSON(r, &options); err != nil {
 		return err
 		return err
 	}
 	}
@@ -32,7 +32,7 @@ func (s *checkpointRouter) getContainerCheckpoints(ctx context.Context, w http.R
 		return err
 		return err
 	}
 	}
 
 
-	checkpoints, err := s.backend.CheckpointList(vars["name"], types.CheckpointListOptions{
+	checkpoints, err := s.backend.CheckpointList(vars["name"], checkpoint.ListOptions{
 		CheckpointDir: r.Form.Get("dir"),
 		CheckpointDir: r.Form.Get("dir"),
 	})
 	})
 	if err != nil {
 	if err != nil {
@@ -47,7 +47,7 @@ func (s *checkpointRouter) deleteContainerCheckpoint(ctx context.Context, w http
 		return err
 		return err
 	}
 	}
 
 
-	err := s.backend.CheckpointDelete(vars["name"], types.CheckpointDeleteOptions{
+	err := s.backend.CheckpointDelete(vars["name"], checkpoint.DeleteOptions{
 		CheckpointDir: r.Form.Get("dir"),
 		CheckpointDir: r.Form.Get("dir"),
 		CheckpointID:  vars["checkpoint"],
 		CheckpointID:  vars["checkpoint"],
 	})
 	})

+ 7 - 0
api/types/checkpoint/list.go

@@ -0,0 +1,7 @@
+package checkpoint
+
+// Summary represents the details of a checkpoint when listing endpoints.
+type Summary struct {
+	// Name is the name of the checkpoint.
+	Name string
+}

+ 19 - 0
api/types/checkpoint/options.go

@@ -0,0 +1,19 @@
+package checkpoint
+
+// CreateOptions holds parameters to create a checkpoint from a container.
+type CreateOptions struct {
+	CheckpointID  string
+	CheckpointDir string
+	Exit          bool
+}
+
+// ListOptions holds parameters to list checkpoints for a container.
+type ListOptions struct {
+	CheckpointDir string
+}
+
+// DeleteOptions holds parameters to delete a checkpoint from a container.
+type DeleteOptions struct {
+	CheckpointID  string
+	CheckpointDir string
+}

+ 0 - 18
api/types/client.go

@@ -11,24 +11,6 @@ import (
 	units "github.com/docker/go-units"
 	units "github.com/docker/go-units"
 )
 )
 
 
-// CheckpointCreateOptions holds parameters to create a checkpoint from a container
-type CheckpointCreateOptions struct {
-	CheckpointID  string
-	CheckpointDir string
-	Exit          bool
-}
-
-// CheckpointListOptions holds parameters to list checkpoints for a container
-type CheckpointListOptions struct {
-	CheckpointDir string
-}
-
-// CheckpointDeleteOptions holds parameters to delete a checkpoint from a container
-type CheckpointDeleteOptions struct {
-	CheckpointID  string
-	CheckpointDir string
-}
-
 // ContainerAttachOptions holds parameters to attach to a container.
 // ContainerAttachOptions holds parameters to attach to a container.
 type ContainerAttachOptions struct {
 type ContainerAttachOptions struct {
 	Stream     bool
 	Stream     bool

+ 0 - 5
api/types/types.go

@@ -494,11 +494,6 @@ type NetworkInspectOptions struct {
 	Verbose bool
 	Verbose bool
 }
 }
 
 
-// Checkpoint represents the details of a checkpoint
-type Checkpoint struct {
-	Name string // Name is the name of the checkpoint
-}
-
 // DiskUsageObject represents an object type used for disk usage query filtering.
 // DiskUsageObject represents an object type used for disk usage query filtering.
 type DiskUsageObject string
 type DiskUsageObject string
 
 

+ 24 - 1
api/types/types_deprecated.go

@@ -1,6 +1,29 @@
 package types
 package types
 
 
-import "github.com/docker/docker/api/types/system"
+import (
+	"github.com/docker/docker/api/types/checkpoint"
+	"github.com/docker/docker/api/types/system"
+)
+
+// CheckpointCreateOptions holds parameters to create a checkpoint from a container.
+//
+// Deprecated: use [checkpoint.CreateOptions].
+type CheckpointCreateOptions = checkpoint.CreateOptions
+
+// CheckpointListOptions holds parameters to list checkpoints for a container
+//
+// Deprecated: use [checkpoint.ListOptions].
+type CheckpointListOptions = checkpoint.ListOptions
+
+// CheckpointDeleteOptions holds parameters to delete a checkpoint from a container
+//
+// Deprecated: use [checkpoint.DeleteOptions].
+type CheckpointDeleteOptions = checkpoint.DeleteOptions
+
+// Checkpoint represents the details of a checkpoint when listing endpoints.
+//
+// Deprecated: use [checkpoint.Summary].
+type Checkpoint = checkpoint.Summary
 
 
 // Info contains response of Engine API:
 // Info contains response of Engine API:
 // GET "/info"
 // GET "/info"

+ 2 - 2
client/checkpoint_create.go

@@ -3,11 +3,11 @@ package client // import "github.com/docker/docker/client"
 import (
 import (
 	"context"
 	"context"
 
 
-	"github.com/docker/docker/api/types"
+	"github.com/docker/docker/api/types/checkpoint"
 )
 )
 
 
 // CheckpointCreate creates a checkpoint from the given container with the given name
 // CheckpointCreate creates a checkpoint from the given container with the given name
-func (cli *Client) CheckpointCreate(ctx context.Context, container string, options types.CheckpointCreateOptions) error {
+func (cli *Client) CheckpointCreate(ctx context.Context, container string, options checkpoint.CreateOptions) error {
 	resp, err := cli.post(ctx, "/containers/"+container+"/checkpoints", nil, options, nil)
 	resp, err := cli.post(ctx, "/containers/"+container+"/checkpoints", nil, options, nil)
 	ensureReaderClosed(resp)
 	ensureReaderClosed(resp)
 	return err
 	return err

+ 4 - 4
client/checkpoint_create_test.go

@@ -10,7 +10,7 @@ import (
 	"strings"
 	"strings"
 	"testing"
 	"testing"
 
 
-	"github.com/docker/docker/api/types"
+	"github.com/docker/docker/api/types/checkpoint"
 	"github.com/docker/docker/errdefs"
 	"github.com/docker/docker/errdefs"
 	"gotest.tools/v3/assert"
 	"gotest.tools/v3/assert"
 	is "gotest.tools/v3/assert/cmp"
 	is "gotest.tools/v3/assert/cmp"
@@ -20,7 +20,7 @@ func TestCheckpointCreateError(t *testing.T) {
 	client := &Client{
 	client := &Client{
 		client: newMockClient(errorMock(http.StatusInternalServerError, "Server error")),
 		client: newMockClient(errorMock(http.StatusInternalServerError, "Server error")),
 	}
 	}
-	err := client.CheckpointCreate(context.Background(), "nothing", types.CheckpointCreateOptions{
+	err := client.CheckpointCreate(context.Background(), "nothing", checkpoint.CreateOptions{
 		CheckpointID: "noting",
 		CheckpointID: "noting",
 		Exit:         true,
 		Exit:         true,
 	})
 	})
@@ -43,7 +43,7 @@ func TestCheckpointCreate(t *testing.T) {
 				return nil, fmt.Errorf("expected POST method, got %s", req.Method)
 				return nil, fmt.Errorf("expected POST method, got %s", req.Method)
 			}
 			}
 
 
-			createOptions := &types.CheckpointCreateOptions{}
+			createOptions := &checkpoint.CreateOptions{}
 			if err := json.NewDecoder(req.Body).Decode(createOptions); err != nil {
 			if err := json.NewDecoder(req.Body).Decode(createOptions); err != nil {
 				return nil, err
 				return nil, err
 			}
 			}
@@ -63,7 +63,7 @@ func TestCheckpointCreate(t *testing.T) {
 		}),
 		}),
 	}
 	}
 
 
-	err := client.CheckpointCreate(context.Background(), expectedContainerID, types.CheckpointCreateOptions{
+	err := client.CheckpointCreate(context.Background(), expectedContainerID, checkpoint.CreateOptions{
 		CheckpointID: expectedCheckpointID,
 		CheckpointID: expectedCheckpointID,
 		Exit:         true,
 		Exit:         true,
 	})
 	})

+ 2 - 2
client/checkpoint_delete.go

@@ -4,11 +4,11 @@ import (
 	"context"
 	"context"
 	"net/url"
 	"net/url"
 
 
-	"github.com/docker/docker/api/types"
+	"github.com/docker/docker/api/types/checkpoint"
 )
 )
 
 
 // CheckpointDelete deletes the checkpoint with the given name from the given container
 // CheckpointDelete deletes the checkpoint with the given name from the given container
-func (cli *Client) CheckpointDelete(ctx context.Context, containerID string, options types.CheckpointDeleteOptions) error {
+func (cli *Client) CheckpointDelete(ctx context.Context, containerID string, options checkpoint.DeleteOptions) error {
 	query := url.Values{}
 	query := url.Values{}
 	if options.CheckpointDir != "" {
 	if options.CheckpointDir != "" {
 		query.Set("dir", options.CheckpointDir)
 		query.Set("dir", options.CheckpointDir)

+ 3 - 3
client/checkpoint_delete_test.go

@@ -9,7 +9,7 @@ import (
 	"strings"
 	"strings"
 	"testing"
 	"testing"
 
 
-	"github.com/docker/docker/api/types"
+	"github.com/docker/docker/api/types/checkpoint"
 	"github.com/docker/docker/errdefs"
 	"github.com/docker/docker/errdefs"
 	"gotest.tools/v3/assert"
 	"gotest.tools/v3/assert"
 	is "gotest.tools/v3/assert/cmp"
 	is "gotest.tools/v3/assert/cmp"
@@ -20,7 +20,7 @@ func TestCheckpointDeleteError(t *testing.T) {
 		client: newMockClient(errorMock(http.StatusInternalServerError, "Server error")),
 		client: newMockClient(errorMock(http.StatusInternalServerError, "Server error")),
 	}
 	}
 
 
-	err := client.CheckpointDelete(context.Background(), "container_id", types.CheckpointDeleteOptions{
+	err := client.CheckpointDelete(context.Background(), "container_id", checkpoint.DeleteOptions{
 		CheckpointID: "checkpoint_id",
 		CheckpointID: "checkpoint_id",
 	})
 	})
 
 
@@ -45,7 +45,7 @@ func TestCheckpointDelete(t *testing.T) {
 		}),
 		}),
 	}
 	}
 
 
-	err := client.CheckpointDelete(context.Background(), "container_id", types.CheckpointDeleteOptions{
+	err := client.CheckpointDelete(context.Background(), "container_id", checkpoint.DeleteOptions{
 		CheckpointID: "checkpoint_id",
 		CheckpointID: "checkpoint_id",
 	})
 	})
 	if err != nil {
 	if err != nil {

+ 3 - 3
client/checkpoint_list.go

@@ -5,12 +5,12 @@ import (
 	"encoding/json"
 	"encoding/json"
 	"net/url"
 	"net/url"
 
 
-	"github.com/docker/docker/api/types"
+	"github.com/docker/docker/api/types/checkpoint"
 )
 )
 
 
 // CheckpointList returns the checkpoints of the given container in the docker host
 // CheckpointList returns the checkpoints of the given container in the docker host
-func (cli *Client) CheckpointList(ctx context.Context, container string, options types.CheckpointListOptions) ([]types.Checkpoint, error) {
-	var checkpoints []types.Checkpoint
+func (cli *Client) CheckpointList(ctx context.Context, container string, options checkpoint.ListOptions) ([]checkpoint.Summary, error) {
+	var checkpoints []checkpoint.Summary
 
 
 	query := url.Values{}
 	query := url.Values{}
 	if options.CheckpointDir != "" {
 	if options.CheckpointDir != "" {

+ 5 - 5
client/checkpoint_list_test.go

@@ -10,7 +10,7 @@ import (
 	"strings"
 	"strings"
 	"testing"
 	"testing"
 
 
-	"github.com/docker/docker/api/types"
+	"github.com/docker/docker/api/types/checkpoint"
 	"github.com/docker/docker/errdefs"
 	"github.com/docker/docker/errdefs"
 	"gotest.tools/v3/assert"
 	"gotest.tools/v3/assert"
 	is "gotest.tools/v3/assert/cmp"
 	is "gotest.tools/v3/assert/cmp"
@@ -21,7 +21,7 @@ func TestCheckpointListError(t *testing.T) {
 		client: newMockClient(errorMock(http.StatusInternalServerError, "Server error")),
 		client: newMockClient(errorMock(http.StatusInternalServerError, "Server error")),
 	}
 	}
 
 
-	_, err := client.CheckpointList(context.Background(), "container_id", types.CheckpointListOptions{})
+	_, err := client.CheckpointList(context.Background(), "container_id", checkpoint.ListOptions{})
 	assert.Check(t, is.ErrorType(err, errdefs.IsSystem))
 	assert.Check(t, is.ErrorType(err, errdefs.IsSystem))
 }
 }
 
 
@@ -33,7 +33,7 @@ func TestCheckpointList(t *testing.T) {
 			if !strings.HasPrefix(req.URL.Path, expectedURL) {
 			if !strings.HasPrefix(req.URL.Path, expectedURL) {
 				return nil, fmt.Errorf("Expected URL '%s', got '%s'", expectedURL, req.URL)
 				return nil, fmt.Errorf("Expected URL '%s', got '%s'", expectedURL, req.URL)
 			}
 			}
-			content, err := json.Marshal([]types.Checkpoint{
+			content, err := json.Marshal([]checkpoint.Summary{
 				{
 				{
 					Name: "checkpoint",
 					Name: "checkpoint",
 				},
 				},
@@ -48,7 +48,7 @@ func TestCheckpointList(t *testing.T) {
 		}),
 		}),
 	}
 	}
 
 
-	checkpoints, err := client.CheckpointList(context.Background(), "container_id", types.CheckpointListOptions{})
+	checkpoints, err := client.CheckpointList(context.Background(), "container_id", checkpoint.ListOptions{})
 	if err != nil {
 	if err != nil {
 		t.Fatal(err)
 		t.Fatal(err)
 	}
 	}
@@ -62,6 +62,6 @@ func TestCheckpointListContainerNotFound(t *testing.T) {
 		client: newMockClient(errorMock(http.StatusNotFound, "Server error")),
 		client: newMockClient(errorMock(http.StatusNotFound, "Server error")),
 	}
 	}
 
 
-	_, err := client.CheckpointList(context.Background(), "unknown", types.CheckpointListOptions{})
+	_, err := client.CheckpointList(context.Background(), "unknown", checkpoint.ListOptions{})
 	assert.Check(t, is.ErrorType(err, errdefs.IsNotFound))
 	assert.Check(t, is.ErrorType(err, errdefs.IsNotFound))
 }
 }

+ 4 - 4
client/interface_experimental.go

@@ -3,7 +3,7 @@ package client // import "github.com/docker/docker/client"
 import (
 import (
 	"context"
 	"context"
 
 
-	"github.com/docker/docker/api/types"
+	"github.com/docker/docker/api/types/checkpoint"
 )
 )
 
 
 type apiClientExperimental interface {
 type apiClientExperimental interface {
@@ -12,7 +12,7 @@ type apiClientExperimental interface {
 
 
 // CheckpointAPIClient defines API client methods for the checkpoints
 // CheckpointAPIClient defines API client methods for the checkpoints
 type CheckpointAPIClient interface {
 type CheckpointAPIClient interface {
-	CheckpointCreate(ctx context.Context, container string, options types.CheckpointCreateOptions) error
-	CheckpointDelete(ctx context.Context, container string, options types.CheckpointDeleteOptions) error
-	CheckpointList(ctx context.Context, container string, options types.CheckpointListOptions) ([]types.Checkpoint, error)
+	CheckpointCreate(ctx context.Context, container string, options checkpoint.CreateOptions) error
+	CheckpointDelete(ctx context.Context, container string, options checkpoint.DeleteOptions) error
+	CheckpointList(ctx context.Context, container string, options checkpoint.ListOptions) ([]checkpoint.Summary, error)
 }
 }

+ 6 - 6
daemon/checkpoint.go

@@ -6,7 +6,7 @@ import (
 	"os"
 	"os"
 	"path/filepath"
 	"path/filepath"
 
 
-	"github.com/docker/docker/api/types"
+	"github.com/docker/docker/api/types/checkpoint"
 	"github.com/docker/docker/daemon/names"
 	"github.com/docker/docker/daemon/names"
 )
 )
 
 
@@ -51,7 +51,7 @@ func getCheckpointDir(checkDir, checkpointID, ctrName, ctrID, ctrCheckpointDir s
 }
 }
 
 
 // CheckpointCreate checkpoints the process running in a container with CRIU
 // CheckpointCreate checkpoints the process running in a container with CRIU
-func (daemon *Daemon) CheckpointCreate(name string, config types.CheckpointCreateOptions) error {
+func (daemon *Daemon) CheckpointCreate(name string, config checkpoint.CreateOptions) error {
 	container, err := daemon.GetContainer(name)
 	container, err := daemon.GetContainer(name)
 	if err != nil {
 	if err != nil {
 		return err
 		return err
@@ -85,7 +85,7 @@ func (daemon *Daemon) CheckpointCreate(name string, config types.CheckpointCreat
 }
 }
 
 
 // CheckpointDelete deletes the specified checkpoint
 // CheckpointDelete deletes the specified checkpoint
-func (daemon *Daemon) CheckpointDelete(name string, config types.CheckpointDeleteOptions) error {
+func (daemon *Daemon) CheckpointDelete(name string, config checkpoint.DeleteOptions) error {
 	container, err := daemon.GetContainer(name)
 	container, err := daemon.GetContainer(name)
 	if err != nil {
 	if err != nil {
 		return err
 		return err
@@ -98,8 +98,8 @@ func (daemon *Daemon) CheckpointDelete(name string, config types.CheckpointDelet
 }
 }
 
 
 // CheckpointList lists all checkpoints of the specified container
 // CheckpointList lists all checkpoints of the specified container
-func (daemon *Daemon) CheckpointList(name string, config types.CheckpointListOptions) ([]types.Checkpoint, error) {
-	var out []types.Checkpoint
+func (daemon *Daemon) CheckpointList(name string, config checkpoint.ListOptions) ([]checkpoint.Summary, error) {
+	var out []checkpoint.Summary
 
 
 	container, err := daemon.GetContainer(name)
 	container, err := daemon.GetContainer(name)
 	if err != nil {
 	if err != nil {
@@ -124,7 +124,7 @@ func (daemon *Daemon) CheckpointList(name string, config types.CheckpointListOpt
 		if !d.IsDir() {
 		if !d.IsDir() {
 			continue
 			continue
 		}
 		}
-		cpt := types.Checkpoint{Name: d.Name()}
+		cpt := checkpoint.Summary{Name: d.Name()}
 		out = append(out, cpt)
 		out = append(out, cpt)
 	}
 	}
 
 

+ 32 - 41
integration/container/checkpoint_test.go

@@ -9,6 +9,7 @@ import (
 	"time"
 	"time"
 
 
 	"github.com/docker/docker/api/types"
 	"github.com/docker/docker/api/types"
+	"github.com/docker/docker/api/types/checkpoint"
 	mounttypes "github.com/docker/docker/api/types/mount"
 	mounttypes "github.com/docker/docker/api/types/mount"
 	"github.com/docker/docker/client"
 	"github.com/docker/docker/client"
 	"github.com/docker/docker/integration/internal/container"
 	"github.com/docker/docker/integration/internal/container"
@@ -36,51 +37,45 @@ func TestCheckpoint(t *testing.T) {
 
 
 	defer setupTest(t)()
 	defer setupTest(t)()
 
 
-	cmd := exec.Command("criu", "check")
-	stdoutStderr, err := cmd.CombinedOutput()
+	stdoutStderr, err := exec.Command("criu", "check").CombinedOutput()
 	t.Logf("%s", stdoutStderr)
 	t.Logf("%s", stdoutStderr)
 	assert.NilError(t, err)
 	assert.NilError(t, err)
 
 
 	ctx := context.Background()
 	ctx := context.Background()
 	apiClient := request.NewAPIClient(t)
 	apiClient := request.NewAPIClient(t)
 
 
-	mnt := mounttypes.Mount{
+	t.Log("Start a container")
+	cID := container.Run(ctx, t, apiClient, container.WithMount(mounttypes.Mount{
 		Type:   mounttypes.TypeTmpfs,
 		Type:   mounttypes.TypeTmpfs,
 		Target: "/tmp",
 		Target: "/tmp",
-	}
-
-	t.Log("Start a container")
-	cID := container.Run(ctx, t, apiClient, container.WithMount(mnt))
+	}))
 	poll.WaitOn(t,
 	poll.WaitOn(t,
 		container.IsInState(ctx, apiClient, cID, "running"),
 		container.IsInState(ctx, apiClient, cID, "running"),
 		poll.WithDelay(100*time.Millisecond),
 		poll.WithDelay(100*time.Millisecond),
 	)
 	)
 
 
-	cptOpt := types.CheckpointCreateOptions{
-		Exit:         false,
-		CheckpointID: "test",
-	}
+	// FIXME: ipv6 iptables modules are not uploaded in the test environment
+	stdoutStderr, err = exec.Command("bash", "-c", "set -x; "+
+		"mount --bind $(type -P true) $(type -P ip6tables-restore) && "+
+		"mount --bind $(type -P true) $(type -P ip6tables-save)",
+	).CombinedOutput()
+	t.Logf("%s", stdoutStderr)
+	assert.NilError(t, err)
 
 
-	{
-		// FIXME: ipv6 iptables modules are not uploaded in the test environment
-		cmd := exec.Command("bash", "-c", "set -x; "+
-			"mount --bind $(type -P true) $(type -P ip6tables-restore) && "+
-			"mount --bind $(type -P true) $(type -P ip6tables-save)")
-		stdoutStderr, err = cmd.CombinedOutput()
+	defer func() {
+		stdoutStderr, err = exec.Command("bash", "-c", "set -x; "+
+			"umount -c -i -l $(type -P ip6tables-restore); "+
+			"umount -c -i -l $(type -P ip6tables-save)",
+		).CombinedOutput()
 		t.Logf("%s", stdoutStderr)
 		t.Logf("%s", stdoutStderr)
 		assert.NilError(t, err)
 		assert.NilError(t, err)
+	}()
 
 
-		defer func() {
-			cmd := exec.Command("bash", "-c", "set -x; "+
-				"umount -c -i -l $(type -P ip6tables-restore); "+
-				"umount -c -i -l $(type -P ip6tables-save)")
-			stdoutStderr, err = cmd.CombinedOutput()
-			t.Logf("%s", stdoutStderr)
-			assert.NilError(t, err)
-		}()
-	}
 	t.Log("Do a checkpoint and leave the container running")
 	t.Log("Do a checkpoint and leave the container running")
-	err = apiClient.CheckpointCreate(ctx, cID, cptOpt)
+	err = apiClient.CheckpointCreate(ctx, cID, checkpoint.CreateOptions{
+		Exit:         false,
+		CheckpointID: "test",
+	})
 	if err != nil {
 	if err != nil {
 		// An error can contain a path to a dump file
 		// An error can contain a path to a dump file
 		t.Log(err)
 		t.Log(err)
@@ -100,7 +95,7 @@ func TestCheckpoint(t *testing.T) {
 	assert.NilError(t, err)
 	assert.NilError(t, err)
 	assert.Check(t, is.Equal(true, inspect.State.Running))
 	assert.Check(t, is.Equal(true, inspect.State.Running))
 
 
-	checkpoints, err := apiClient.CheckpointList(ctx, cID, types.CheckpointListOptions{})
+	checkpoints, err := apiClient.CheckpointList(ctx, cID, checkpoint.ListOptions{})
 	assert.NilError(t, err)
 	assert.NilError(t, err)
 	assert.Equal(t, len(checkpoints), 1)
 	assert.Equal(t, len(checkpoints), 1)
 	assert.Equal(t, checkpoints[0].Name, "test")
 	assert.Equal(t, checkpoints[0].Name, "test")
@@ -109,12 +104,11 @@ func TestCheckpoint(t *testing.T) {
 	containerExec(t, apiClient, cID, []string{"touch", "/tmp/test-file"})
 	containerExec(t, apiClient, cID, []string{"touch", "/tmp/test-file"})
 
 
 	// Do a second checkpoint
 	// Do a second checkpoint
-	cptOpt = types.CheckpointCreateOptions{
+	t.Log("Do a checkpoint and stop the container")
+	err = apiClient.CheckpointCreate(ctx, cID, checkpoint.CreateOptions{
 		Exit:         true,
 		Exit:         true,
 		CheckpointID: "test2",
 		CheckpointID: "test2",
-	}
-	t.Log("Do a checkpoint and stop the container")
-	err = apiClient.CheckpointCreate(ctx, cID, cptOpt)
+	})
 	assert.NilError(t, err)
 	assert.NilError(t, err)
 
 
 	poll.WaitOn(t,
 	poll.WaitOn(t,
@@ -127,7 +121,7 @@ func TestCheckpoint(t *testing.T) {
 	assert.Check(t, is.Equal(false, inspect.State.Running))
 	assert.Check(t, is.Equal(false, inspect.State.Running))
 
 
 	// Check that both checkpoints are listed.
 	// Check that both checkpoints are listed.
-	checkpoints, err = apiClient.CheckpointList(ctx, cID, types.CheckpointListOptions{})
+	checkpoints, err = apiClient.CheckpointList(ctx, cID, checkpoint.ListOptions{})
 	assert.NilError(t, err)
 	assert.NilError(t, err)
 	assert.Equal(t, len(checkpoints), 2)
 	assert.Equal(t, len(checkpoints), 2)
 	cptNames := make([]string, 2)
 	cptNames := make([]string, 2)
@@ -139,11 +133,10 @@ func TestCheckpoint(t *testing.T) {
 	assert.Equal(t, cptNames[1], "test2")
 	assert.Equal(t, cptNames[1], "test2")
 
 
 	// Restore the container from a second checkpoint.
 	// Restore the container from a second checkpoint.
-	startOpt := types.ContainerStartOptions{
-		CheckpointID: "test2",
-	}
 	t.Log("Restore the container")
 	t.Log("Restore the container")
-	err = apiClient.ContainerStart(ctx, cID, startOpt)
+	err = apiClient.ContainerStart(ctx, cID, types.ContainerStartOptions{
+		CheckpointID: "test2",
+	})
 	assert.NilError(t, err)
 	assert.NilError(t, err)
 
 
 	inspect, err = apiClient.ContainerInspect(ctx, cID)
 	inspect, err = apiClient.ContainerInspect(ctx, cID)
@@ -154,11 +147,9 @@ func TestCheckpoint(t *testing.T) {
 	containerExec(t, apiClient, cID, []string{"test", "-f", "/tmp/test-file"})
 	containerExec(t, apiClient, cID, []string{"test", "-f", "/tmp/test-file"})
 
 
 	for _, id := range []string{"test", "test2"} {
 	for _, id := range []string{"test", "test2"} {
-		cptDelOpt := types.CheckpointDeleteOptions{
+		err = apiClient.CheckpointDelete(ctx, cID, checkpoint.DeleteOptions{
 			CheckpointID: id,
 			CheckpointID: id,
-		}
-
-		err = apiClient.CheckpointDelete(ctx, cID, cptDelOpt)
+		})
 		assert.NilError(t, err)
 		assert.NilError(t, err)
 	}
 	}
 }
 }