api/types: move ContainerStartOptions to api/types/container
Signed-off-by: Sebastiaan van Stijn <github@gone.nl>
This commit is contained in:
parent
0f77875220
commit
7bce33eb0f
23 changed files with 60 additions and 64 deletions
|
@ -43,12 +43,6 @@ type ContainerLogsOptions struct {
|
||||||
Details bool
|
Details bool
|
||||||
}
|
}
|
||||||
|
|
||||||
// ContainerStartOptions holds parameters to start containers.
|
|
||||||
type ContainerStartOptions struct {
|
|
||||||
CheckpointID string
|
|
||||||
CheckpointDir string
|
|
||||||
}
|
|
||||||
|
|
||||||
// CopyToContainerOptions holds information
|
// CopyToContainerOptions holds information
|
||||||
// about files to copy into a container
|
// about files to copy into a container
|
||||||
type CopyToContainerOptions struct {
|
type CopyToContainerOptions struct {
|
||||||
|
|
|
@ -34,3 +34,9 @@ type RemoveOptions struct {
|
||||||
RemoveLinks bool
|
RemoveLinks bool
|
||||||
Force bool
|
Force bool
|
||||||
}
|
}
|
||||||
|
|
||||||
|
// StartOptions holds parameters to start containers.
|
||||||
|
type StartOptions struct {
|
||||||
|
CheckpointID string
|
||||||
|
CheckpointDir string
|
||||||
|
}
|
||||||
|
|
|
@ -92,6 +92,11 @@ type ServiceCreateResponse = swarm.ServiceCreateResponse
|
||||||
// Deprecated: use [swarm.ServiceUpdateResponse].
|
// Deprecated: use [swarm.ServiceUpdateResponse].
|
||||||
type ServiceUpdateResponse = swarm.ServiceUpdateResponse
|
type ServiceUpdateResponse = swarm.ServiceUpdateResponse
|
||||||
|
|
||||||
|
// ContainerStartOptions holds parameters to start containers.
|
||||||
|
//
|
||||||
|
// Deprecated: use [container.StartOptions].
|
||||||
|
type ContainerStartOptions = container.StartOptions
|
||||||
|
|
||||||
// ResizeOptions holds parameters to resize a TTY.
|
// ResizeOptions holds parameters to resize a TTY.
|
||||||
// It can be used to resize container TTYs and
|
// It can be used to resize container TTYs and
|
||||||
// exec process TTYs too.
|
// exec process TTYs too.
|
||||||
|
|
|
@ -4,11 +4,11 @@ import (
|
||||||
"context"
|
"context"
|
||||||
"net/url"
|
"net/url"
|
||||||
|
|
||||||
"github.com/docker/docker/api/types"
|
"github.com/docker/docker/api/types/container"
|
||||||
)
|
)
|
||||||
|
|
||||||
// ContainerStart sends a request to the docker daemon to start a container.
|
// ContainerStart sends a request to the docker daemon to start a container.
|
||||||
func (cli *Client) ContainerStart(ctx context.Context, containerID string, options types.ContainerStartOptions) error {
|
func (cli *Client) ContainerStart(ctx context.Context, containerID string, options container.StartOptions) error {
|
||||||
query := url.Values{}
|
query := url.Values{}
|
||||||
if len(options.CheckpointID) != 0 {
|
if len(options.CheckpointID) != 0 {
|
||||||
query.Set("checkpoint", options.CheckpointID)
|
query.Set("checkpoint", options.CheckpointID)
|
||||||
|
|
|
@ -10,7 +10,7 @@ import (
|
||||||
"strings"
|
"strings"
|
||||||
"testing"
|
"testing"
|
||||||
|
|
||||||
"github.com/docker/docker/api/types"
|
"github.com/docker/docker/api/types/container"
|
||||||
"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 TestContainerStartError(t *testing.T) {
|
||||||
client := &Client{
|
client := &Client{
|
||||||
client: newMockClient(errorMock(http.StatusInternalServerError, "Server error")),
|
client: newMockClient(errorMock(http.StatusInternalServerError, "Server error")),
|
||||||
}
|
}
|
||||||
err := client.ContainerStart(context.Background(), "nothing", types.ContainerStartOptions{})
|
err := client.ContainerStart(context.Background(), "nothing", container.StartOptions{})
|
||||||
assert.Check(t, is.ErrorType(err, errdefs.IsSystem))
|
assert.Check(t, is.ErrorType(err, errdefs.IsSystem))
|
||||||
}
|
}
|
||||||
|
|
||||||
|
@ -51,7 +51,7 @@ func TestContainerStart(t *testing.T) {
|
||||||
}),
|
}),
|
||||||
}
|
}
|
||||||
|
|
||||||
err := client.ContainerStart(context.Background(), "container_id", types.ContainerStartOptions{CheckpointID: "checkpoint_id"})
|
err := client.ContainerStart(context.Background(), "container_id", container.StartOptions{CheckpointID: "checkpoint_id"})
|
||||||
if err != nil {
|
if err != nil {
|
||||||
t.Fatal(err)
|
t.Fatal(err)
|
||||||
}
|
}
|
||||||
|
|
|
@ -69,7 +69,7 @@ type ContainerAPIClient interface {
|
||||||
ContainerStatPath(ctx context.Context, container, path string) (types.ContainerPathStat, error)
|
ContainerStatPath(ctx context.Context, container, path string) (types.ContainerPathStat, error)
|
||||||
ContainerStats(ctx context.Context, container string, stream bool) (types.ContainerStats, error)
|
ContainerStats(ctx context.Context, container string, stream bool) (types.ContainerStats, error)
|
||||||
ContainerStatsOneShot(ctx context.Context, container string) (types.ContainerStats, error)
|
ContainerStatsOneShot(ctx context.Context, container string) (types.ContainerStats, error)
|
||||||
ContainerStart(ctx context.Context, container string, options types.ContainerStartOptions) error
|
ContainerStart(ctx context.Context, container string, options container.StartOptions) error
|
||||||
ContainerStop(ctx context.Context, container string, options container.StopOptions) error
|
ContainerStop(ctx context.Context, container string, options container.StopOptions) error
|
||||||
ContainerTop(ctx context.Context, container string, arguments []string) (container.ContainerTopOKBody, error)
|
ContainerTop(ctx context.Context, container string, arguments []string) (container.ContainerTopOKBody, error)
|
||||||
ContainerUnpause(ctx context.Context, container string) error
|
ContainerUnpause(ctx context.Context, container string) error
|
||||||
|
|
|
@ -924,12 +924,12 @@ func (s *DockerAPISuite) TestContainerAPIStart(c *testing.T) {
|
||||||
_, err = apiClient.ContainerCreate(testutil.GetContext(c), &config, &container.HostConfig{}, &network.NetworkingConfig{}, nil, name)
|
_, err = apiClient.ContainerCreate(testutil.GetContext(c), &config, &container.HostConfig{}, &network.NetworkingConfig{}, nil, name)
|
||||||
assert.NilError(c, err)
|
assert.NilError(c, err)
|
||||||
|
|
||||||
err = apiClient.ContainerStart(testutil.GetContext(c), name, types.ContainerStartOptions{})
|
err = apiClient.ContainerStart(testutil.GetContext(c), name, container.StartOptions{})
|
||||||
assert.NilError(c, err)
|
assert.NilError(c, err)
|
||||||
|
|
||||||
// second call to start should give 304
|
// second call to start should give 304
|
||||||
// maybe add ContainerStartWithRaw to test it
|
// maybe add ContainerStartWithRaw to test it
|
||||||
err = apiClient.ContainerStart(testutil.GetContext(c), name, types.ContainerStartOptions{})
|
err = apiClient.ContainerStart(testutil.GetContext(c), name, container.StartOptions{})
|
||||||
assert.NilError(c, err)
|
assert.NilError(c, err)
|
||||||
|
|
||||||
// TODO(tibor): figure out why this doesn't work on windows
|
// TODO(tibor): figure out why this doesn't work on windows
|
||||||
|
@ -1572,7 +1572,7 @@ func (s *DockerAPISuite) TestContainerAPIStatsWithNetworkDisabled(c *testing.T)
|
||||||
_, err = apiClient.ContainerCreate(testutil.GetContext(c), &config, &container.HostConfig{}, &network.NetworkingConfig{}, nil, name)
|
_, err = apiClient.ContainerCreate(testutil.GetContext(c), &config, &container.HostConfig{}, &network.NetworkingConfig{}, nil, name)
|
||||||
assert.NilError(c, err)
|
assert.NilError(c, err)
|
||||||
|
|
||||||
err = apiClient.ContainerStart(testutil.GetContext(c), name, types.ContainerStartOptions{})
|
err = apiClient.ContainerStart(testutil.GetContext(c), name, container.StartOptions{})
|
||||||
assert.NilError(c, err)
|
assert.NilError(c, err)
|
||||||
|
|
||||||
assert.Assert(c, waitRun(name) == nil)
|
assert.Assert(c, waitRun(name) == nil)
|
||||||
|
@ -2112,7 +2112,7 @@ func (s *DockerAPISuite) TestContainersAPICreateMountsCreate(c *testing.T) {
|
||||||
assert.Check(c, is.Equal(x.expected.Mode, mountPoint.Mode))
|
assert.Check(c, is.Equal(x.expected.Mode, mountPoint.Mode))
|
||||||
assert.Check(c, is.Equal(x.expected.Destination, mountPoint.Destination))
|
assert.Check(c, is.Equal(x.expected.Destination, mountPoint.Destination))
|
||||||
|
|
||||||
err = apiclient.ContainerStart(ctx, ctr.ID, types.ContainerStartOptions{})
|
err = apiclient.ContainerStart(ctx, ctr.ID, container.StartOptions{})
|
||||||
assert.NilError(c, err)
|
assert.NilError(c, err)
|
||||||
poll.WaitOn(c, containerExit(ctx, apiclient, ctr.ID), poll.WithDelay(time.Second))
|
poll.WaitOn(c, containerExit(ctx, apiclient, ctr.ID), poll.WithDelay(time.Second))
|
||||||
|
|
||||||
|
|
|
@ -10,7 +10,6 @@ import (
|
||||||
"testing"
|
"testing"
|
||||||
|
|
||||||
winio "github.com/Microsoft/go-winio"
|
winio "github.com/Microsoft/go-winio"
|
||||||
"github.com/docker/docker/api/types"
|
|
||||||
"github.com/docker/docker/api/types/container"
|
"github.com/docker/docker/api/types/container"
|
||||||
"github.com/docker/docker/api/types/mount"
|
"github.com/docker/docker/api/types/mount"
|
||||||
"github.com/docker/docker/testutil"
|
"github.com/docker/docker/testutil"
|
||||||
|
@ -66,7 +65,7 @@ func (s *DockerAPISuite) TestContainersAPICreateMountsBindNamedPipe(c *testing.T
|
||||||
nil, nil, name)
|
nil, nil, name)
|
||||||
assert.NilError(c, err)
|
assert.NilError(c, err)
|
||||||
|
|
||||||
err = client.ContainerStart(ctx, name, types.ContainerStartOptions{})
|
err = client.ContainerStart(ctx, name, container.StartOptions{})
|
||||||
assert.NilError(c, err)
|
assert.NilError(c, err)
|
||||||
|
|
||||||
err = <-ch
|
err = <-ch
|
||||||
|
|
|
@ -8,8 +8,8 @@ import (
|
||||||
"testing"
|
"testing"
|
||||||
"time"
|
"time"
|
||||||
|
|
||||||
"github.com/docker/docker/api/types"
|
|
||||||
"github.com/docker/docker/api/types/checkpoint"
|
"github.com/docker/docker/api/types/checkpoint"
|
||||||
|
containertypes "github.com/docker/docker/api/types/container"
|
||||||
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"
|
||||||
|
@ -128,7 +128,7 @@ func TestCheckpoint(t *testing.T) {
|
||||||
|
|
||||||
// Restore the container from a second checkpoint.
|
// Restore the container from a second checkpoint.
|
||||||
t.Log("Restore the container")
|
t.Log("Restore the container")
|
||||||
err = apiClient.ContainerStart(ctx, cID, types.ContainerStartOptions{
|
err = apiClient.ContainerStart(ctx, cID, containertypes.StartOptions{
|
||||||
CheckpointID: "test2",
|
CheckpointID: "test2",
|
||||||
})
|
})
|
||||||
assert.NilError(t, err)
|
assert.NilError(t, err)
|
||||||
|
|
|
@ -8,9 +8,7 @@ import (
|
||||||
"testing"
|
"testing"
|
||||||
"time"
|
"time"
|
||||||
|
|
||||||
"github.com/docker/docker/api/types"
|
|
||||||
"github.com/docker/docker/api/types/container"
|
"github.com/docker/docker/api/types/container"
|
||||||
containertypes "github.com/docker/docker/api/types/container"
|
|
||||||
"github.com/docker/docker/api/types/network"
|
"github.com/docker/docker/api/types/network"
|
||||||
"github.com/docker/docker/api/types/versions"
|
"github.com/docker/docker/api/types/versions"
|
||||||
"github.com/docker/docker/client"
|
"github.com/docker/docker/client"
|
||||||
|
@ -253,7 +251,7 @@ func TestCreateWithCustomMaskedPaths(t *testing.T) {
|
||||||
checkInspect(t, ctx, name, tc.expected)
|
checkInspect(t, ctx, name, tc.expected)
|
||||||
|
|
||||||
// Start the container.
|
// Start the container.
|
||||||
err = apiClient.ContainerStart(ctx, c.ID, types.ContainerStartOptions{})
|
err = apiClient.ContainerStart(ctx, c.ID, container.StartOptions{})
|
||||||
assert.NilError(t, err)
|
assert.NilError(t, err)
|
||||||
|
|
||||||
poll.WaitOn(t, ctr.IsInState(ctx, apiClient, c.ID, "exited"), poll.WithDelay(100*time.Millisecond))
|
poll.WaitOn(t, ctr.IsInState(ctx, apiClient, c.ID, "exited"), poll.WithDelay(100*time.Millisecond))
|
||||||
|
@ -331,7 +329,7 @@ func TestCreateWithCustomReadonlyPaths(t *testing.T) {
|
||||||
checkInspect(t, ctx, name, tc.expected)
|
checkInspect(t, ctx, name, tc.expected)
|
||||||
|
|
||||||
// Start the container.
|
// Start the container.
|
||||||
err = apiClient.ContainerStart(ctx, c.ID, types.ContainerStartOptions{})
|
err = apiClient.ContainerStart(ctx, c.ID, container.StartOptions{})
|
||||||
assert.NilError(t, err)
|
assert.NilError(t, err)
|
||||||
|
|
||||||
poll.WaitOn(t, ctr.IsInState(ctx, apiClient, c.ID, "exited"), poll.WithDelay(100*time.Millisecond))
|
poll.WaitOn(t, ctr.IsInState(ctx, apiClient, c.ID, "exited"), poll.WithDelay(100*time.Millisecond))
|
||||||
|
@ -436,7 +434,7 @@ func TestCreateTmpfsOverrideAnonymousVolume(t *testing.T) {
|
||||||
)
|
)
|
||||||
|
|
||||||
defer func() {
|
defer func() {
|
||||||
err := apiClient.ContainerRemove(ctx, id, containertypes.RemoveOptions{Force: true})
|
err := apiClient.ContainerRemove(ctx, id, container.RemoveOptions{Force: true})
|
||||||
assert.NilError(t, err)
|
assert.NilError(t, err)
|
||||||
}()
|
}()
|
||||||
|
|
||||||
|
@ -447,7 +445,7 @@ func TestCreateTmpfsOverrideAnonymousVolume(t *testing.T) {
|
||||||
assert.Assert(t, is.Len(inspect.Mounts, 0))
|
assert.Assert(t, is.Len(inspect.Mounts, 0))
|
||||||
|
|
||||||
chWait, chErr := apiClient.ContainerWait(ctx, id, container.WaitConditionNextExit)
|
chWait, chErr := apiClient.ContainerWait(ctx, id, container.WaitConditionNextExit)
|
||||||
assert.NilError(t, apiClient.ContainerStart(ctx, id, types.ContainerStartOptions{}))
|
assert.NilError(t, apiClient.ContainerStart(ctx, id, container.StartOptions{}))
|
||||||
|
|
||||||
timeout := time.NewTimer(30 * time.Second)
|
timeout := time.NewTimer(30 * time.Second)
|
||||||
defer timeout.Stop()
|
defer timeout.Stop()
|
||||||
|
@ -483,7 +481,7 @@ func TestCreateDifferentPlatform(t *testing.T) {
|
||||||
Architecture: img.Architecture,
|
Architecture: img.Architecture,
|
||||||
Variant: img.Variant,
|
Variant: img.Variant,
|
||||||
}
|
}
|
||||||
_, err := apiClient.ContainerCreate(ctx, &containertypes.Config{Image: "busybox:latest"}, &containertypes.HostConfig{}, nil, &p, "")
|
_, err := apiClient.ContainerCreate(ctx, &container.Config{Image: "busybox:latest"}, &container.HostConfig{}, nil, &p, "")
|
||||||
assert.Check(t, is.ErrorType(err, errdefs.IsNotFound))
|
assert.Check(t, is.ErrorType(err, errdefs.IsNotFound))
|
||||||
})
|
})
|
||||||
t.Run("different cpu arch", func(t *testing.T) {
|
t.Run("different cpu arch", func(t *testing.T) {
|
||||||
|
@ -493,7 +491,7 @@ func TestCreateDifferentPlatform(t *testing.T) {
|
||||||
Architecture: img.Architecture + "DifferentArch",
|
Architecture: img.Architecture + "DifferentArch",
|
||||||
Variant: img.Variant,
|
Variant: img.Variant,
|
||||||
}
|
}
|
||||||
_, err := apiClient.ContainerCreate(ctx, &containertypes.Config{Image: "busybox:latest"}, &containertypes.HostConfig{}, nil, &p, "")
|
_, err := apiClient.ContainerCreate(ctx, &container.Config{Image: "busybox:latest"}, &container.HostConfig{}, nil, &p, "")
|
||||||
assert.Check(t, is.ErrorType(err, errdefs.IsNotFound))
|
assert.Check(t, is.ErrorType(err, errdefs.IsNotFound))
|
||||||
})
|
})
|
||||||
}
|
}
|
||||||
|
@ -541,32 +539,32 @@ func TestCreateInvalidHostConfig(t *testing.T) {
|
||||||
|
|
||||||
testCases := []struct {
|
testCases := []struct {
|
||||||
doc string
|
doc string
|
||||||
hc containertypes.HostConfig
|
hc container.HostConfig
|
||||||
expectedErr string
|
expectedErr string
|
||||||
}{
|
}{
|
||||||
{
|
{
|
||||||
doc: "invalid IpcMode",
|
doc: "invalid IpcMode",
|
||||||
hc: containertypes.HostConfig{IpcMode: "invalid"},
|
hc: container.HostConfig{IpcMode: "invalid"},
|
||||||
expectedErr: "Error response from daemon: invalid IPC mode: invalid",
|
expectedErr: "Error response from daemon: invalid IPC mode: invalid",
|
||||||
},
|
},
|
||||||
{
|
{
|
||||||
doc: "invalid PidMode",
|
doc: "invalid PidMode",
|
||||||
hc: containertypes.HostConfig{PidMode: "invalid"},
|
hc: container.HostConfig{PidMode: "invalid"},
|
||||||
expectedErr: "Error response from daemon: invalid PID mode: invalid",
|
expectedErr: "Error response from daemon: invalid PID mode: invalid",
|
||||||
},
|
},
|
||||||
{
|
{
|
||||||
doc: "invalid PidMode without container ID",
|
doc: "invalid PidMode without container ID",
|
||||||
hc: containertypes.HostConfig{PidMode: "container"},
|
hc: container.HostConfig{PidMode: "container"},
|
||||||
expectedErr: "Error response from daemon: invalid PID mode: container",
|
expectedErr: "Error response from daemon: invalid PID mode: container",
|
||||||
},
|
},
|
||||||
{
|
{
|
||||||
doc: "invalid UTSMode",
|
doc: "invalid UTSMode",
|
||||||
hc: containertypes.HostConfig{UTSMode: "invalid"},
|
hc: container.HostConfig{UTSMode: "invalid"},
|
||||||
expectedErr: "Error response from daemon: invalid UTS mode: invalid",
|
expectedErr: "Error response from daemon: invalid UTS mode: invalid",
|
||||||
},
|
},
|
||||||
{
|
{
|
||||||
doc: "invalid Annotations",
|
doc: "invalid Annotations",
|
||||||
hc: containertypes.HostConfig{Annotations: map[string]string{"": "a"}},
|
hc: container.HostConfig{Annotations: map[string]string{"": "a"}},
|
||||||
expectedErr: "Error response from daemon: invalid Annotations: the empty string is not permitted as an annotation key",
|
expectedErr: "Error response from daemon: invalid Annotations: the empty string is not permitted as an annotation key",
|
||||||
},
|
},
|
||||||
}
|
}
|
||||||
|
|
|
@ -49,7 +49,7 @@ func TestContainerStartOnDaemonRestart(t *testing.T) {
|
||||||
cID := container.Create(ctx, t, c)
|
cID := container.Create(ctx, t, c)
|
||||||
defer c.ContainerRemove(ctx, cID, containertypes.RemoveOptions{Force: true})
|
defer c.ContainerRemove(ctx, cID, containertypes.RemoveOptions{Force: true})
|
||||||
|
|
||||||
err := c.ContainerStart(ctx, cID, types.ContainerStartOptions{})
|
err := c.ContainerStart(ctx, cID, containertypes.StartOptions{})
|
||||||
assert.Check(t, err, "error starting test container")
|
assert.Check(t, err, "error starting test container")
|
||||||
|
|
||||||
inspect, err := c.ContainerInspect(ctx, cID)
|
inspect, err := c.ContainerInspect(ctx, cID)
|
||||||
|
@ -68,7 +68,7 @@ func TestContainerStartOnDaemonRestart(t *testing.T) {
|
||||||
|
|
||||||
d.Start(t, "--iptables=false")
|
d.Start(t, "--iptables=false")
|
||||||
|
|
||||||
err = c.ContainerStart(ctx, cID, types.ContainerStartOptions{})
|
err = c.ContainerStart(ctx, cID, containertypes.StartOptions{})
|
||||||
assert.Check(t, err, "failed to start test container")
|
assert.Check(t, err, "failed to start test container")
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
|
@ -4,7 +4,6 @@ import (
|
||||||
"strings"
|
"strings"
|
||||||
"testing"
|
"testing"
|
||||||
|
|
||||||
"github.com/docker/docker/api/types"
|
|
||||||
containertypes "github.com/docker/docker/api/types/container"
|
containertypes "github.com/docker/docker/api/types/container"
|
||||||
"github.com/docker/docker/integration/internal/container"
|
"github.com/docker/docker/integration/internal/container"
|
||||||
"github.com/docker/docker/testutil"
|
"github.com/docker/docker/testutil"
|
||||||
|
@ -100,7 +99,7 @@ func TestWindowsDevices(t *testing.T) {
|
||||||
// remove this skip.If and validate the expected behaviour under Hyper-V.
|
// remove this skip.If and validate the expected behaviour under Hyper-V.
|
||||||
skip.If(t, d.isolation == containertypes.IsolationHyperV && !d.expectedStartFailure, "FIXME. HyperV isolation setup is probably incorrect in the test")
|
skip.If(t, d.isolation == containertypes.IsolationHyperV && !d.expectedStartFailure, "FIXME. HyperV isolation setup is probably incorrect in the test")
|
||||||
|
|
||||||
err := apiClient.ContainerStart(ctx, id, types.ContainerStartOptions{})
|
err := apiClient.ContainerStart(ctx, id, containertypes.StartOptions{})
|
||||||
if d.expectedStartFailure {
|
if d.expectedStartFailure {
|
||||||
assert.ErrorContains(t, err, d.expectedStartFailureMessage)
|
assert.ErrorContains(t, err, d.expectedStartFailureMessage)
|
||||||
return
|
return
|
||||||
|
|
|
@ -7,7 +7,6 @@ import (
|
||||||
"strings"
|
"strings"
|
||||||
"testing"
|
"testing"
|
||||||
|
|
||||||
"github.com/docker/docker/api/types"
|
|
||||||
containertypes "github.com/docker/docker/api/types/container"
|
containertypes "github.com/docker/docker/api/types/container"
|
||||||
"github.com/docker/docker/api/types/versions"
|
"github.com/docker/docker/api/types/versions"
|
||||||
"github.com/docker/docker/client"
|
"github.com/docker/docker/client"
|
||||||
|
@ -68,7 +67,7 @@ func testIpcNonePrivateShareable(t *testing.T, mode string, mustBeMounted bool,
|
||||||
assert.NilError(t, err)
|
assert.NilError(t, err)
|
||||||
assert.Check(t, is.Equal(len(resp.Warnings), 0))
|
assert.Check(t, is.Equal(len(resp.Warnings), 0))
|
||||||
|
|
||||||
err = apiClient.ContainerStart(ctx, resp.ID, types.ContainerStartOptions{})
|
err = apiClient.ContainerStart(ctx, resp.ID, containertypes.StartOptions{})
|
||||||
assert.NilError(t, err)
|
assert.NilError(t, err)
|
||||||
|
|
||||||
// get major:minor pair for /dev/shm from container's /proc/self/mountinfo
|
// get major:minor pair for /dev/shm from container's /proc/self/mountinfo
|
||||||
|
@ -140,7 +139,7 @@ func testIpcContainer(t *testing.T, donorMode string, mustWork bool) {
|
||||||
assert.Check(t, is.Equal(len(resp.Warnings), 0))
|
assert.Check(t, is.Equal(len(resp.Warnings), 0))
|
||||||
name1 := resp.ID
|
name1 := resp.ID
|
||||||
|
|
||||||
err = apiClient.ContainerStart(ctx, name1, types.ContainerStartOptions{})
|
err = apiClient.ContainerStart(ctx, name1, containertypes.StartOptions{})
|
||||||
assert.NilError(t, err)
|
assert.NilError(t, err)
|
||||||
|
|
||||||
// create and start the second container
|
// create and start the second container
|
||||||
|
@ -150,7 +149,7 @@ func testIpcContainer(t *testing.T, donorMode string, mustWork bool) {
|
||||||
assert.Check(t, is.Equal(len(resp.Warnings), 0))
|
assert.Check(t, is.Equal(len(resp.Warnings), 0))
|
||||||
name2 := resp.ID
|
name2 := resp.ID
|
||||||
|
|
||||||
err = apiClient.ContainerStart(ctx, name2, types.ContainerStartOptions{})
|
err = apiClient.ContainerStart(ctx, name2, containertypes.StartOptions{})
|
||||||
if !mustWork {
|
if !mustWork {
|
||||||
// start should fail with a specific error
|
// start should fail with a specific error
|
||||||
assert.Check(t, is.ErrorContains(err, "non-shareable IPC"))
|
assert.Check(t, is.ErrorContains(err, "non-shareable IPC"))
|
||||||
|
@ -206,7 +205,7 @@ func TestAPIIpcModeHost(t *testing.T) {
|
||||||
assert.Check(t, is.Equal(len(resp.Warnings), 0))
|
assert.Check(t, is.Equal(len(resp.Warnings), 0))
|
||||||
name := resp.ID
|
name := resp.ID
|
||||||
|
|
||||||
err = apiClient.ContainerStart(ctx, name, types.ContainerStartOptions{})
|
err = apiClient.ContainerStart(ctx, name, containertypes.StartOptions{})
|
||||||
assert.NilError(t, err)
|
assert.NilError(t, err)
|
||||||
|
|
||||||
// check that IPC is shared
|
// check that IPC is shared
|
||||||
|
@ -241,7 +240,7 @@ func testDaemonIpcPrivateShareable(t *testing.T, mustBeShared bool, arg ...strin
|
||||||
assert.NilError(t, err)
|
assert.NilError(t, err)
|
||||||
assert.Check(t, is.Equal(len(resp.Warnings), 0))
|
assert.Check(t, is.Equal(len(resp.Warnings), 0))
|
||||||
|
|
||||||
err = c.ContainerStart(ctx, resp.ID, types.ContainerStartOptions{})
|
err = c.ContainerStart(ctx, resp.ID, containertypes.StartOptions{})
|
||||||
assert.NilError(t, err)
|
assert.NilError(t, err)
|
||||||
|
|
||||||
// get major:minor pair for /dev/shm from container's /proc/self/mountinfo
|
// get major:minor pair for /dev/shm from container's /proc/self/mountinfo
|
||||||
|
|
|
@ -8,7 +8,6 @@ import (
|
||||||
"testing"
|
"testing"
|
||||||
"time"
|
"time"
|
||||||
|
|
||||||
"github.com/docker/docker/api/types"
|
|
||||||
containertypes "github.com/docker/docker/api/types/container"
|
containertypes "github.com/docker/docker/api/types/container"
|
||||||
mounttypes "github.com/docker/docker/api/types/mount"
|
mounttypes "github.com/docker/docker/api/types/mount"
|
||||||
"github.com/docker/docker/api/types/network"
|
"github.com/docker/docker/api/types/network"
|
||||||
|
@ -67,7 +66,7 @@ func TestContainerNetworkMountsNoChown(t *testing.T) {
|
||||||
ctrCreate, err := cli.ContainerCreate(ctx, &config, &hostConfig, &network.NetworkingConfig{}, nil, "")
|
ctrCreate, err := cli.ContainerCreate(ctx, &config, &hostConfig, &network.NetworkingConfig{}, nil, "")
|
||||||
assert.NilError(t, err)
|
assert.NilError(t, err)
|
||||||
// container will exit immediately because of no tty, but we only need the start sequence to test the condition
|
// container will exit immediately because of no tty, but we only need the start sequence to test the condition
|
||||||
err = cli.ContainerStart(ctx, ctrCreate.ID, types.ContainerStartOptions{})
|
err = cli.ContainerStart(ctx, ctrCreate.ID, containertypes.StartOptions{})
|
||||||
assert.NilError(t, err)
|
assert.NilError(t, err)
|
||||||
|
|
||||||
// Check that host-located bind mount network file did not change ownership when the container was started
|
// Check that host-located bind mount network file did not change ownership when the container was started
|
||||||
|
|
|
@ -4,7 +4,7 @@ import (
|
||||||
"os"
|
"os"
|
||||||
"testing"
|
"testing"
|
||||||
|
|
||||||
"github.com/docker/docker/api/types"
|
containertypes "github.com/docker/docker/api/types/container"
|
||||||
"github.com/docker/docker/errdefs"
|
"github.com/docker/docker/errdefs"
|
||||||
"github.com/docker/docker/integration/internal/container"
|
"github.com/docker/docker/integration/internal/container"
|
||||||
"gotest.tools/v3/assert"
|
"gotest.tools/v3/assert"
|
||||||
|
@ -50,7 +50,7 @@ func TestPIDModeContainer(t *testing.T) {
|
||||||
ctr, err := container.CreateFromConfig(ctx, apiClient, container.NewTestConfig(container.WithPIDMode("container:"+pidCtrName)))
|
ctr, err := container.CreateFromConfig(ctx, apiClient, container.NewTestConfig(container.WithPIDMode("container:"+pidCtrName)))
|
||||||
assert.NilError(t, err, "should not produce an error when creating, only when starting")
|
assert.NilError(t, err, "should not produce an error when creating, only when starting")
|
||||||
|
|
||||||
err = apiClient.ContainerStart(ctx, ctr.ID, types.ContainerStartOptions{})
|
err = apiClient.ContainerStart(ctx, ctr.ID, containertypes.StartOptions{})
|
||||||
assert.Check(t, is.ErrorType(err, errdefs.IsSystem), "should produce a System error when starting an existing container from an invalid state")
|
assert.Check(t, is.ErrorType(err, errdefs.IsSystem), "should produce a System error when starting an existing container from an invalid state")
|
||||||
assert.Check(t, is.ErrorContains(err, "failed to join PID namespace"))
|
assert.Check(t, is.ErrorContains(err, "failed to join PID namespace"))
|
||||||
assert.Check(t, is.ErrorContains(err, cPIDContainerID+" is not running"))
|
assert.Check(t, is.ErrorContains(err, cPIDContainerID+" is not running"))
|
||||||
|
@ -63,7 +63,7 @@ func TestPIDModeContainer(t *testing.T) {
|
||||||
ctr, err := container.CreateFromConfig(ctx, apiClient, container.NewTestConfig(container.WithPIDMode("container:"+pidCtrName)))
|
ctr, err := container.CreateFromConfig(ctx, apiClient, container.NewTestConfig(container.WithPIDMode("container:"+pidCtrName)))
|
||||||
assert.NilError(t, err)
|
assert.NilError(t, err)
|
||||||
|
|
||||||
err = apiClient.ContainerStart(ctx, ctr.ID, types.ContainerStartOptions{})
|
err = apiClient.ContainerStart(ctx, ctr.ID, containertypes.StartOptions{})
|
||||||
assert.Check(t, err)
|
assert.Check(t, err)
|
||||||
})
|
})
|
||||||
}
|
}
|
||||||
|
|
|
@ -135,7 +135,7 @@ func TestRenameAnonymousContainer(t *testing.T) {
|
||||||
// FIXME(vdemeester) this is a really weird behavior as it fails otherwise
|
// FIXME(vdemeester) this is a really weird behavior as it fails otherwise
|
||||||
err = apiClient.ContainerStop(ctx, container1Name, containertypes.StopOptions{})
|
err = apiClient.ContainerStop(ctx, container1Name, containertypes.StopOptions{})
|
||||||
assert.NilError(t, err)
|
assert.NilError(t, err)
|
||||||
err = apiClient.ContainerStart(ctx, container1Name, types.ContainerStartOptions{})
|
err = apiClient.ContainerStart(ctx, container1Name, containertypes.StartOptions{})
|
||||||
assert.NilError(t, err)
|
assert.NilError(t, err)
|
||||||
|
|
||||||
count := "-c"
|
count := "-c"
|
||||||
|
|
|
@ -6,7 +6,6 @@ import (
|
||||||
"testing"
|
"testing"
|
||||||
"time"
|
"time"
|
||||||
|
|
||||||
"github.com/docker/docker/api/types"
|
|
||||||
"github.com/docker/docker/api/types/container"
|
"github.com/docker/docker/api/types/container"
|
||||||
"github.com/docker/docker/client"
|
"github.com/docker/docker/client"
|
||||||
testContainer "github.com/docker/docker/integration/internal/container"
|
testContainer "github.com/docker/docker/integration/internal/container"
|
||||||
|
@ -105,7 +104,7 @@ func TestDaemonRestartKillContainers(t *testing.T) {
|
||||||
defer apiClient.ContainerRemove(ctx, resp.ID, container.RemoveOptions{Force: true})
|
defer apiClient.ContainerRemove(ctx, resp.ID, container.RemoveOptions{Force: true})
|
||||||
|
|
||||||
if tc.xStart {
|
if tc.xStart {
|
||||||
err = apiClient.ContainerStart(ctx, resp.ID, types.ContainerStartOptions{})
|
err = apiClient.ContainerStart(ctx, resp.ID, container.StartOptions{})
|
||||||
assert.NilError(t, err)
|
assert.NilError(t, err)
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
|
@ -4,7 +4,6 @@ import (
|
||||||
"testing"
|
"testing"
|
||||||
"time"
|
"time"
|
||||||
|
|
||||||
"github.com/docker/docker/api/types"
|
|
||||||
containertypes "github.com/docker/docker/api/types/container"
|
containertypes "github.com/docker/docker/api/types/container"
|
||||||
"github.com/docker/docker/integration/internal/container"
|
"github.com/docker/docker/integration/internal/container"
|
||||||
"github.com/docker/docker/testutil"
|
"github.com/docker/docker/testutil"
|
||||||
|
@ -149,7 +148,7 @@ func TestWaitConditions(t *testing.T) {
|
||||||
assert.NilError(t, err)
|
assert.NilError(t, err)
|
||||||
defer streams.Close()
|
defer streams.Close()
|
||||||
|
|
||||||
assert.NilError(t, cli.ContainerStart(ctx, containerID, types.ContainerStartOptions{}))
|
assert.NilError(t, cli.ContainerStart(ctx, containerID, containertypes.StartOptions{}))
|
||||||
waitResC, errC := cli.ContainerWait(ctx, containerID, tc.waitCond)
|
waitResC, errC := cli.ContainerWait(ctx, containerID, tc.waitCond)
|
||||||
select {
|
select {
|
||||||
case err := <-errC:
|
case err := <-errC:
|
||||||
|
|
|
@ -77,7 +77,7 @@ func Run(ctx context.Context, t *testing.T, apiClient client.APIClient, ops ...f
|
||||||
t.Helper()
|
t.Helper()
|
||||||
id := Create(ctx, t, apiClient, ops...)
|
id := Create(ctx, t, apiClient, ops...)
|
||||||
|
|
||||||
err := apiClient.ContainerStart(ctx, id, types.ContainerStartOptions{})
|
err := apiClient.ContainerStart(ctx, id, container.StartOptions{})
|
||||||
assert.NilError(t, err)
|
assert.NilError(t, err)
|
||||||
|
|
||||||
return id
|
return id
|
||||||
|
@ -106,7 +106,7 @@ func RunAttach(ctx context.Context, t *testing.T, apiClient client.APIClient, op
|
||||||
})
|
})
|
||||||
assert.NilError(t, err)
|
assert.NilError(t, err)
|
||||||
|
|
||||||
err = apiClient.ContainerStart(ctx, id, types.ContainerStartOptions{})
|
err = apiClient.ContainerStart(ctx, id, container.StartOptions{})
|
||||||
assert.NilError(t, err)
|
assert.NilError(t, err)
|
||||||
|
|
||||||
s, err := demultiplexStreams(ctx, aresp)
|
s, err := demultiplexStreams(ctx, aresp)
|
||||||
|
|
|
@ -62,7 +62,7 @@ func TestReadPluginNoRead(t *testing.T) {
|
||||||
assert.Assert(t, err)
|
assert.Assert(t, err)
|
||||||
defer client.ContainerRemove(ctx, c.ID, container.RemoveOptions{Force: true})
|
defer client.ContainerRemove(ctx, c.ID, container.RemoveOptions{Force: true})
|
||||||
|
|
||||||
err = client.ContainerStart(ctx, c.ID, types.ContainerStartOptions{})
|
err = client.ContainerStart(ctx, c.ID, container.StartOptions{})
|
||||||
assert.Assert(t, err)
|
assert.Assert(t, err)
|
||||||
|
|
||||||
logs, err := client.ContainerLogs(ctx, c.ID, types.ContainerLogsOptions{ShowStdout: true})
|
logs, err := client.ContainerLogs(ctx, c.ID, types.ContainerLogsOptions{ShowStdout: true})
|
||||||
|
|
|
@ -3,7 +3,7 @@ package service // import "github.com/docker/docker/integration/service"
|
||||||
import (
|
import (
|
||||||
"testing"
|
"testing"
|
||||||
|
|
||||||
"github.com/docker/docker/api/types"
|
containertypes "github.com/docker/docker/api/types/container"
|
||||||
"github.com/docker/docker/api/types/network"
|
"github.com/docker/docker/api/types/network"
|
||||||
"github.com/docker/docker/integration/internal/container"
|
"github.com/docker/docker/integration/internal/container"
|
||||||
net "github.com/docker/docker/integration/internal/network"
|
net "github.com/docker/docker/integration/internal/network"
|
||||||
|
@ -43,7 +43,7 @@ func TestDockerNetworkConnectAlias(t *testing.T) {
|
||||||
})
|
})
|
||||||
assert.NilError(t, err)
|
assert.NilError(t, err)
|
||||||
|
|
||||||
err = client.ContainerStart(ctx, cID1, types.ContainerStartOptions{})
|
err = client.ContainerStart(ctx, cID1, containertypes.StartOptions{})
|
||||||
assert.NilError(t, err)
|
assert.NilError(t, err)
|
||||||
|
|
||||||
ng1, err := client.ContainerInspect(ctx, cID1)
|
ng1, err := client.ContainerInspect(ctx, cID1)
|
||||||
|
@ -66,7 +66,7 @@ func TestDockerNetworkConnectAlias(t *testing.T) {
|
||||||
})
|
})
|
||||||
assert.NilError(t, err)
|
assert.NilError(t, err)
|
||||||
|
|
||||||
err = client.ContainerStart(ctx, cID2, types.ContainerStartOptions{})
|
err = client.ContainerStart(ctx, cID2, containertypes.StartOptions{})
|
||||||
assert.NilError(t, err)
|
assert.NilError(t, err)
|
||||||
|
|
||||||
ng2, err := client.ContainerInspect(ctx, cID2)
|
ng2, err := client.ContainerInspect(ctx, cID2)
|
||||||
|
@ -101,7 +101,7 @@ func TestDockerNetworkReConnect(t *testing.T) {
|
||||||
err := client.NetworkConnect(ctx, name, c1, &network.EndpointSettings{})
|
err := client.NetworkConnect(ctx, name, c1, &network.EndpointSettings{})
|
||||||
assert.NilError(t, err)
|
assert.NilError(t, err)
|
||||||
|
|
||||||
err = client.ContainerStart(ctx, c1, types.ContainerStartOptions{})
|
err = client.ContainerStart(ctx, c1, containertypes.StartOptions{})
|
||||||
assert.NilError(t, err)
|
assert.NilError(t, err)
|
||||||
|
|
||||||
n1, err := client.ContainerInspect(ctx, c1)
|
n1, err := client.ContainerInspect(ctx, c1)
|
||||||
|
|
|
@ -4,7 +4,6 @@ import (
|
||||||
"os"
|
"os"
|
||||||
"testing"
|
"testing"
|
||||||
|
|
||||||
"github.com/docker/docker/api/types"
|
|
||||||
containertypes "github.com/docker/docker/api/types/container"
|
containertypes "github.com/docker/docker/api/types/container"
|
||||||
"github.com/docker/docker/integration/internal/container"
|
"github.com/docker/docker/integration/internal/container"
|
||||||
"github.com/docker/docker/testutil"
|
"github.com/docker/docker/testutil"
|
||||||
|
@ -48,7 +47,7 @@ func TestCgroupDriverSystemdMemoryLimit(t *testing.T) {
|
||||||
})
|
})
|
||||||
defer c.ContainerRemove(ctx, ctrID, containertypes.RemoveOptions{Force: true})
|
defer c.ContainerRemove(ctx, ctrID, containertypes.RemoveOptions{Force: true})
|
||||||
|
|
||||||
err := c.ContainerStart(ctx, ctrID, types.ContainerStartOptions{})
|
err := c.ContainerStart(ctx, ctrID, containertypes.StartOptions{})
|
||||||
assert.NilError(t, err)
|
assert.NilError(t, err)
|
||||||
|
|
||||||
s, err := c.ContainerInspect(ctx, ctrID)
|
s, err := c.ContainerInspect(ctx, ctrID)
|
||||||
|
|
|
@ -157,7 +157,7 @@ COPY . /static`); err != nil {
|
||||||
Image: image,
|
Image: image,
|
||||||
}, &containertypes.HostConfig{}, nil, nil, container)
|
}, &containertypes.HostConfig{}, nil, nil, container)
|
||||||
assert.NilError(t, err)
|
assert.NilError(t, err)
|
||||||
err = c.ContainerStart(context.Background(), b.ID, types.ContainerStartOptions{})
|
err = c.ContainerStart(context.Background(), b.ID, containertypes.StartOptions{})
|
||||||
assert.NilError(t, err)
|
assert.NilError(t, err)
|
||||||
|
|
||||||
// Find out the system assigned port
|
// Find out the system assigned port
|
||||||
|
|
Loading…
Reference in a new issue