mirror of
https://github.com/docker/cli.git
synced 2026-09-27 17:56:04 -04:00
Integration: use testenv.APIClient()
A client is already created in testenv.New(), so we can just as well use that one, instead of creating a new client. Signed-off-by: Sebastiaan van Stijn <github@gone.nl> (cherry picked from commit 0de62d9bbcb92e9b7c73ee4cdef51c2229878e05) Signed-off-by: Sebastiaan van Stijn <github@gone.nl> Upstream-commit: e438d4799d6e233fe631d332973dcac1d977fef6 Component: engine
This commit is contained in:
@@ -12,7 +12,6 @@ import (
|
||||
"github.com/docker/docker/api/types/container"
|
||||
"github.com/docker/docker/api/types/network"
|
||||
ctr "github.com/docker/docker/integration/internal/container"
|
||||
"github.com/docker/docker/internal/test/request"
|
||||
"github.com/docker/docker/oci"
|
||||
"gotest.tools/assert"
|
||||
is "gotest.tools/assert/cmp"
|
||||
@@ -22,7 +21,7 @@ import (
|
||||
|
||||
func TestCreateFailsWhenIdentifierDoesNotExist(t *testing.T) {
|
||||
defer setupTest(t)()
|
||||
client := request.NewAPIClient(t)
|
||||
client := testEnv.APIClient()
|
||||
|
||||
testCases := []struct {
|
||||
doc string
|
||||
@@ -63,7 +62,7 @@ func TestCreateFailsWhenIdentifierDoesNotExist(t *testing.T) {
|
||||
|
||||
func TestCreateWithInvalidEnv(t *testing.T) {
|
||||
defer setupTest(t)()
|
||||
client := request.NewAPIClient(t)
|
||||
client := testEnv.APIClient()
|
||||
|
||||
testCases := []struct {
|
||||
env string
|
||||
@@ -106,7 +105,7 @@ func TestCreateTmpfsMountsTarget(t *testing.T) {
|
||||
skip.If(t, testEnv.DaemonInfo.OSType == "windows")
|
||||
|
||||
defer setupTest(t)()
|
||||
client := request.NewAPIClient(t)
|
||||
client := testEnv.APIClient()
|
||||
|
||||
testCases := []struct {
|
||||
target string
|
||||
@@ -148,7 +147,7 @@ func TestCreateWithCustomMaskedPaths(t *testing.T) {
|
||||
skip.If(t, testEnv.DaemonInfo.OSType != "linux")
|
||||
|
||||
defer setupTest(t)()
|
||||
client := request.NewAPIClient(t)
|
||||
client := testEnv.APIClient()
|
||||
ctx := context.Background()
|
||||
|
||||
testCases := []struct {
|
||||
@@ -227,7 +226,7 @@ func TestCreateWithCustomReadonlyPaths(t *testing.T) {
|
||||
skip.If(t, testEnv.DaemonInfo.OSType != "linux")
|
||||
|
||||
defer setupTest(t)()
|
||||
client := request.NewAPIClient(t)
|
||||
client := testEnv.APIClient()
|
||||
ctx := context.Background()
|
||||
|
||||
testCases := []struct {
|
||||
|
||||
@@ -7,7 +7,6 @@ import (
|
||||
|
||||
containertypes "github.com/docker/docker/api/types/container"
|
||||
"github.com/docker/docker/integration/internal/container"
|
||||
"github.com/docker/docker/internal/test/request"
|
||||
"github.com/docker/docker/pkg/archive"
|
||||
"gotest.tools/assert"
|
||||
"gotest.tools/poll"
|
||||
@@ -17,7 +16,7 @@ import (
|
||||
func TestDiff(t *testing.T) {
|
||||
skip.If(t, testEnv.OSType == "windows", "FIXME")
|
||||
defer setupTest(t)()
|
||||
client := request.NewAPIClient(t)
|
||||
client := testEnv.APIClient()
|
||||
ctx := context.Background()
|
||||
|
||||
cID := container.Run(t, ctx, client, container.WithCmd("sh", "-c", `mkdir /foo; echo xyzzy > /foo/bar`))
|
||||
|
||||
@@ -10,7 +10,6 @@ import (
|
||||
"github.com/docker/docker/api/types/strslice"
|
||||
"github.com/docker/docker/api/types/versions"
|
||||
"github.com/docker/docker/integration/internal/container"
|
||||
"github.com/docker/docker/internal/test/request"
|
||||
"gotest.tools/assert"
|
||||
is "gotest.tools/assert/cmp"
|
||||
"gotest.tools/skip"
|
||||
@@ -22,7 +21,7 @@ func TestExecWithCloseStdin(t *testing.T) {
|
||||
defer setupTest(t)()
|
||||
|
||||
ctx := context.Background()
|
||||
client := request.NewAPIClient(t)
|
||||
client := testEnv.APIClient()
|
||||
|
||||
// run top with detached mode
|
||||
cID := container.Run(t, ctx, client)
|
||||
@@ -89,7 +88,7 @@ func TestExec(t *testing.T) {
|
||||
skip.If(t, testEnv.OSType == "windows", "FIXME. Probably needs to wait for container to be in running state.")
|
||||
defer setupTest(t)()
|
||||
ctx := context.Background()
|
||||
client := request.NewAPIClient(t)
|
||||
client := testEnv.APIClient()
|
||||
|
||||
cID := container.Run(t, ctx, client, container.WithTty(true), container.WithWorkingDir("/root"))
|
||||
|
||||
|
||||
@@ -10,7 +10,6 @@ import (
|
||||
"github.com/docker/docker/api/types/filters"
|
||||
"github.com/docker/docker/integration/internal/container"
|
||||
"github.com/docker/docker/internal/test/daemon"
|
||||
"github.com/docker/docker/internal/test/request"
|
||||
"github.com/docker/docker/pkg/jsonmessage"
|
||||
"gotest.tools/assert"
|
||||
is "gotest.tools/assert/cmp"
|
||||
@@ -23,7 +22,7 @@ func TestExportContainerAndImportImage(t *testing.T) {
|
||||
skip.If(t, testEnv.DaemonInfo.OSType == "windows")
|
||||
|
||||
defer setupTest(t)()
|
||||
client := request.NewAPIClient(t)
|
||||
client := testEnv.APIClient()
|
||||
ctx := context.Background()
|
||||
|
||||
cID := container.Run(t, ctx, client, container.WithCmd("true"))
|
||||
|
||||
@@ -9,7 +9,6 @@ import (
|
||||
containertypes "github.com/docker/docker/api/types/container"
|
||||
"github.com/docker/docker/client"
|
||||
"github.com/docker/docker/integration/internal/container"
|
||||
"github.com/docker/docker/internal/test/request"
|
||||
"gotest.tools/poll"
|
||||
"gotest.tools/skip"
|
||||
)
|
||||
@@ -20,7 +19,7 @@ func TestHealthCheckWorkdir(t *testing.T) {
|
||||
skip.If(t, testEnv.OSType == "windows", "FIXME")
|
||||
defer setupTest(t)()
|
||||
ctx := context.Background()
|
||||
client := request.NewAPIClient(t)
|
||||
client := testEnv.APIClient()
|
||||
|
||||
cID := container.Run(t, ctx, client, container.WithTty(true), container.WithWorkingDir("/foo"), func(c *container.TestContainerConfig) {
|
||||
c.Config.Healthcheck = &containertypes.HealthConfig{
|
||||
|
||||
@@ -13,7 +13,6 @@ import (
|
||||
containertypes "github.com/docker/docker/api/types/container"
|
||||
"github.com/docker/docker/integration/internal/container"
|
||||
"github.com/docker/docker/internal/test/daemon"
|
||||
"github.com/docker/docker/internal/test/request"
|
||||
"gotest.tools/assert"
|
||||
is "gotest.tools/assert/cmp"
|
||||
"gotest.tools/fs"
|
||||
@@ -61,7 +60,7 @@ func testIpcNonePrivateShareable(t *testing.T, mode string, mustBeMounted bool,
|
||||
hostCfg := containertypes.HostConfig{
|
||||
IpcMode: containertypes.IpcMode(mode),
|
||||
}
|
||||
client := request.NewAPIClient(t)
|
||||
client := testEnv.APIClient()
|
||||
ctx := context.Background()
|
||||
|
||||
resp, err := client.ContainerCreate(ctx, &cfg, &hostCfg, nil, "")
|
||||
@@ -132,7 +131,7 @@ func testIpcContainer(t *testing.T, donorMode string, mustWork bool) {
|
||||
IpcMode: containertypes.IpcMode(donorMode),
|
||||
}
|
||||
ctx := context.Background()
|
||||
client := request.NewAPIClient(t)
|
||||
client := testEnv.APIClient()
|
||||
|
||||
// create and start the "donor" container
|
||||
resp, err := client.ContainerCreate(ctx, &cfg, &hostCfg, nil, "")
|
||||
|
||||
@@ -17,7 +17,7 @@ import (
|
||||
|
||||
func TestKillContainerInvalidSignal(t *testing.T) {
|
||||
defer setupTest(t)()
|
||||
client := request.NewAPIClient(t)
|
||||
client := testEnv.APIClient()
|
||||
ctx := context.Background()
|
||||
id := container.Run(t, ctx, client)
|
||||
|
||||
@@ -33,7 +33,7 @@ func TestKillContainerInvalidSignal(t *testing.T) {
|
||||
func TestKillContainer(t *testing.T) {
|
||||
skip.If(t, testEnv.OSType == "windows", "TODO Windows: FIXME. No SIGWINCH")
|
||||
defer setupTest(t)()
|
||||
client := request.NewAPIClient(t)
|
||||
client := testEnv.APIClient()
|
||||
|
||||
testCases := []struct {
|
||||
doc string
|
||||
@@ -73,7 +73,7 @@ func TestKillContainer(t *testing.T) {
|
||||
func TestKillWithStopSignalAndRestartPolicies(t *testing.T) {
|
||||
skip.If(t, testEnv.OSType == "windows", "Windows only supports 1.25 or later")
|
||||
defer setupTest(t)()
|
||||
client := request.NewAPIClient(t)
|
||||
client := testEnv.APIClient()
|
||||
|
||||
testCases := []struct {
|
||||
doc string
|
||||
@@ -114,7 +114,7 @@ func TestKillStoppedContainer(t *testing.T) {
|
||||
skip.If(t, testEnv.OSType == "windows", "Windows only supports 1.25 or later")
|
||||
defer setupTest(t)()
|
||||
ctx := context.Background()
|
||||
client := request.NewAPIClient(t)
|
||||
client := testEnv.APIClient()
|
||||
id := container.Create(t, ctx, client)
|
||||
err := client.ContainerKill(ctx, id, "SIGKILL")
|
||||
assert.Assert(t, is.ErrorContains(err, ""))
|
||||
@@ -154,7 +154,7 @@ func TestInspectOomKilledTrue(t *testing.T) {
|
||||
|
||||
defer setupTest(t)()
|
||||
ctx := context.Background()
|
||||
client := request.NewAPIClient(t)
|
||||
client := testEnv.APIClient()
|
||||
|
||||
cID := container.Run(t, ctx, client, container.WithCmd("sh", "-c", "x=a; while true; do x=$x$x$x$x; done"), func(c *container.TestContainerConfig) {
|
||||
c.HostConfig.Resources.Memory = 32 * 1024 * 1024
|
||||
@@ -172,7 +172,7 @@ func TestInspectOomKilledFalse(t *testing.T) {
|
||||
|
||||
defer setupTest(t)()
|
||||
ctx := context.Background()
|
||||
client := request.NewAPIClient(t)
|
||||
client := testEnv.APIClient()
|
||||
|
||||
cID := container.Run(t, ctx, client, container.WithCmd("sh", "-c", "echo hello world"))
|
||||
|
||||
|
||||
@@ -9,7 +9,6 @@ import (
|
||||
"github.com/docker/docker/api/types"
|
||||
"github.com/docker/docker/api/types/filters"
|
||||
"github.com/docker/docker/integration/internal/container"
|
||||
"github.com/docker/docker/internal/test/request"
|
||||
"gotest.tools/assert"
|
||||
is "gotest.tools/assert/cmp"
|
||||
"gotest.tools/skip"
|
||||
@@ -22,7 +21,7 @@ func TestLinksEtcHostsContentMatch(t *testing.T) {
|
||||
skip.If(t, os.IsNotExist(err))
|
||||
|
||||
defer setupTest(t)()
|
||||
client := request.NewAPIClient(t)
|
||||
client := testEnv.APIClient()
|
||||
ctx := context.Background()
|
||||
|
||||
cID := container.Run(t, ctx, client, container.WithNetworkMode("host"))
|
||||
@@ -38,7 +37,7 @@ func TestLinksContainerNames(t *testing.T) {
|
||||
skip.If(t, testEnv.DaemonInfo.OSType == "windows")
|
||||
|
||||
defer setupTest(t)()
|
||||
client := request.NewAPIClient(t)
|
||||
client := testEnv.APIClient()
|
||||
ctx := context.Background()
|
||||
|
||||
containerA := "first_" + t.Name()
|
||||
|
||||
@@ -7,7 +7,6 @@ import (
|
||||
|
||||
"github.com/docker/docker/api/types"
|
||||
"github.com/docker/docker/integration/internal/container"
|
||||
"github.com/docker/docker/internal/test/request"
|
||||
"github.com/docker/docker/pkg/stdcopy"
|
||||
"gotest.tools/assert"
|
||||
"gotest.tools/skip"
|
||||
@@ -19,7 +18,7 @@ func TestLogsFollowTailEmpty(t *testing.T) {
|
||||
// FIXME(vdemeester) fails on a e2e run on linux...
|
||||
skip.If(t, testEnv.IsRemoteDaemon())
|
||||
defer setupTest(t)()
|
||||
client := request.NewAPIClient(t)
|
||||
client := testEnv.APIClient()
|
||||
ctx := context.Background()
|
||||
|
||||
id := container.Run(t, ctx, client, container.WithCmd("sleep", "100000"))
|
||||
|
||||
@@ -11,7 +11,6 @@ import (
|
||||
"github.com/docker/docker/api/types/mount"
|
||||
"github.com/docker/docker/api/types/network"
|
||||
"github.com/docker/docker/client"
|
||||
"github.com/docker/docker/internal/test/request"
|
||||
"github.com/docker/docker/pkg/system"
|
||||
"gotest.tools/assert"
|
||||
is "gotest.tools/assert/cmp"
|
||||
@@ -82,9 +81,9 @@ func TestContainerNetworkMountsNoChown(t *testing.T) {
|
||||
|
||||
func TestMountDaemonRoot(t *testing.T) {
|
||||
skip.If(t, testEnv.DaemonInfo.OSType == "windows" || testEnv.IsRemoteDaemon())
|
||||
t.Parallel()
|
||||
|
||||
client := request.NewAPIClient(t)
|
||||
defer setupTest(t)()
|
||||
client := testEnv.APIClient()
|
||||
ctx := context.Background()
|
||||
info, err := client.Info(ctx)
|
||||
if err != nil {
|
||||
|
||||
@@ -13,7 +13,6 @@ import (
|
||||
|
||||
"github.com/docker/docker/api/types"
|
||||
"github.com/docker/docker/integration/internal/container"
|
||||
"github.com/docker/docker/internal/test/request"
|
||||
"github.com/docker/go-connections/nat"
|
||||
"gotest.tools/assert"
|
||||
is "gotest.tools/assert/cmp"
|
||||
@@ -22,6 +21,7 @@ import (
|
||||
)
|
||||
|
||||
func TestNetworkNat(t *testing.T) {
|
||||
skip.If(t, testEnv.OSType == "windows", "FIXME")
|
||||
skip.If(t, testEnv.IsRemoteDaemon())
|
||||
|
||||
defer setupTest(t)()
|
||||
@@ -58,6 +58,7 @@ func TestNetworkLocalhostTCPNat(t *testing.T) {
|
||||
}
|
||||
|
||||
func TestNetworkLoopbackNat(t *testing.T) {
|
||||
skip.If(t, testEnv.OSType == "windows", "FIXME")
|
||||
skip.If(t, testEnv.IsRemoteDaemon())
|
||||
|
||||
defer setupTest(t)()
|
||||
@@ -67,7 +68,7 @@ func TestNetworkLoopbackNat(t *testing.T) {
|
||||
|
||||
endpoint := getExternalAddress(t)
|
||||
|
||||
client := request.NewAPIClient(t)
|
||||
client := testEnv.APIClient()
|
||||
ctx := context.Background()
|
||||
|
||||
cID := container.Run(t, ctx, client, container.WithCmd("sh", "-c", fmt.Sprintf("stty raw && nc -w 5 %s 8080", endpoint.String())), container.WithTty(true), container.WithNetworkMode("container:"+serverContainerID))
|
||||
@@ -88,7 +89,8 @@ func TestNetworkLoopbackNat(t *testing.T) {
|
||||
}
|
||||
|
||||
func startServerContainer(t *testing.T, msg string, port int) string {
|
||||
client := request.NewAPIClient(t)
|
||||
t.Helper()
|
||||
client := testEnv.APIClient()
|
||||
ctx := context.Background()
|
||||
|
||||
cID := container.Run(t, ctx, client, container.WithName("server-"+t.Name()), container.WithCmd("sh", "-c", fmt.Sprintf("echo %q | nc -lp %d", msg, port)), container.WithExposedPorts(fmt.Sprintf("%d/tcp", port)), func(c *container.TestContainerConfig) {
|
||||
@@ -107,7 +109,7 @@ func startServerContainer(t *testing.T, msg string, port int) string {
|
||||
}
|
||||
|
||||
func getExternalAddress(t *testing.T) net.IP {
|
||||
skip.If(t, testEnv.OSType == "windows", "FIXME")
|
||||
t.Helper()
|
||||
iface, err := net.InterfaceByName("eth0")
|
||||
skip.If(t, err != nil, "Test not running with `make test-integration`. Interface eth0 not found: %s", err)
|
||||
|
||||
|
||||
@@ -22,7 +22,7 @@ func TestPause(t *testing.T) {
|
||||
skip.If(t, testEnv.DaemonInfo.OSType == "windows" && testEnv.DaemonInfo.Isolation == "process")
|
||||
|
||||
defer setupTest(t)()
|
||||
client := request.NewAPIClient(t)
|
||||
client := testEnv.APIClient()
|
||||
ctx := context.Background()
|
||||
|
||||
cID := container.Run(t, ctx, client)
|
||||
@@ -54,7 +54,7 @@ func TestPauseFailsOnWindowsServerContainers(t *testing.T) {
|
||||
skip.If(t, testEnv.DaemonInfo.OSType != "windows" || testEnv.DaemonInfo.Isolation != "process")
|
||||
|
||||
defer setupTest(t)()
|
||||
client := request.NewAPIClient(t)
|
||||
client := testEnv.APIClient()
|
||||
ctx := context.Background()
|
||||
|
||||
cID := container.Run(t, ctx, client)
|
||||
@@ -68,7 +68,7 @@ func TestPauseStopPausedContainer(t *testing.T) {
|
||||
skip.If(t, testEnv.DaemonInfo.OSType == "windows")
|
||||
skip.If(t, versions.LessThan(testEnv.DaemonAPIVersion(), "1.31"), "broken in earlier versions")
|
||||
defer setupTest(t)()
|
||||
client := request.NewAPIClient(t)
|
||||
client := testEnv.APIClient()
|
||||
ctx := context.Background()
|
||||
|
||||
cID := container.Run(t, ctx, client)
|
||||
|
||||
@@ -7,14 +7,13 @@ import (
|
||||
"github.com/docker/docker/api/types"
|
||||
"github.com/docker/docker/api/types/filters"
|
||||
"github.com/docker/docker/integration/internal/container"
|
||||
"github.com/docker/docker/internal/test/request"
|
||||
"gotest.tools/assert"
|
||||
is "gotest.tools/assert/cmp"
|
||||
)
|
||||
|
||||
func TestPsFilter(t *testing.T) {
|
||||
defer setupTest(t)()
|
||||
client := request.NewAPIClient(t)
|
||||
client := testEnv.APIClient()
|
||||
ctx := context.Background()
|
||||
|
||||
prev := container.Create(t, ctx, client)
|
||||
|
||||
@@ -9,7 +9,6 @@ import (
|
||||
"github.com/docker/docker/api/types"
|
||||
"github.com/docker/docker/api/types/filters"
|
||||
"github.com/docker/docker/integration/internal/container"
|
||||
"github.com/docker/docker/internal/test/request"
|
||||
"gotest.tools/assert"
|
||||
is "gotest.tools/assert/cmp"
|
||||
"gotest.tools/fs"
|
||||
@@ -30,7 +29,7 @@ func TestRemoveContainerWithRemovedVolume(t *testing.T) {
|
||||
|
||||
defer setupTest(t)()
|
||||
ctx := context.Background()
|
||||
client := request.NewAPIClient(t)
|
||||
client := testEnv.APIClient()
|
||||
|
||||
prefix, slash := getPrefixAndSlashFromDaemonPlatform()
|
||||
|
||||
@@ -56,7 +55,7 @@ func TestRemoveContainerWithRemovedVolume(t *testing.T) {
|
||||
func TestRemoveContainerWithVolume(t *testing.T) {
|
||||
defer setupTest(t)()
|
||||
ctx := context.Background()
|
||||
client := request.NewAPIClient(t)
|
||||
client := testEnv.APIClient()
|
||||
|
||||
prefix, slash := getPrefixAndSlashFromDaemonPlatform()
|
||||
|
||||
@@ -81,7 +80,7 @@ func TestRemoveContainerWithVolume(t *testing.T) {
|
||||
func TestRemoveContainerRunning(t *testing.T) {
|
||||
defer setupTest(t)()
|
||||
ctx := context.Background()
|
||||
client := request.NewAPIClient(t)
|
||||
client := testEnv.APIClient()
|
||||
|
||||
cID := container.Run(t, ctx, client)
|
||||
|
||||
@@ -92,7 +91,7 @@ func TestRemoveContainerRunning(t *testing.T) {
|
||||
func TestRemoveContainerForceRemoveRunning(t *testing.T) {
|
||||
defer setupTest(t)()
|
||||
ctx := context.Background()
|
||||
client := request.NewAPIClient(t)
|
||||
client := testEnv.APIClient()
|
||||
|
||||
cID := container.Run(t, ctx, client)
|
||||
|
||||
@@ -105,7 +104,7 @@ func TestRemoveContainerForceRemoveRunning(t *testing.T) {
|
||||
func TestRemoveInvalidContainer(t *testing.T) {
|
||||
defer setupTest(t)()
|
||||
ctx := context.Background()
|
||||
client := request.NewAPIClient(t)
|
||||
client := testEnv.APIClient()
|
||||
|
||||
err := client.ContainerRemove(ctx, "unknown", types.ContainerRemoveOptions{})
|
||||
assert.Check(t, is.ErrorContains(err, "No such container"))
|
||||
|
||||
@@ -10,7 +10,6 @@ import (
|
||||
"github.com/docker/docker/api/types/network"
|
||||
"github.com/docker/docker/api/types/versions"
|
||||
"github.com/docker/docker/integration/internal/container"
|
||||
"github.com/docker/docker/internal/test/request"
|
||||
"github.com/docker/docker/pkg/stringid"
|
||||
"gotest.tools/assert"
|
||||
is "gotest.tools/assert/cmp"
|
||||
@@ -27,7 +26,7 @@ func TestRenameLinkedContainer(t *testing.T) {
|
||||
skip.If(t, testEnv.OSType == "windows", "FIXME")
|
||||
defer setupTest(t)()
|
||||
ctx := context.Background()
|
||||
client := request.NewAPIClient(t)
|
||||
client := testEnv.APIClient()
|
||||
|
||||
aName := "a0" + t.Name()
|
||||
bName := "b0" + t.Name()
|
||||
@@ -52,7 +51,7 @@ func TestRenameLinkedContainer(t *testing.T) {
|
||||
func TestRenameStoppedContainer(t *testing.T) {
|
||||
defer setupTest(t)()
|
||||
ctx := context.Background()
|
||||
client := request.NewAPIClient(t)
|
||||
client := testEnv.APIClient()
|
||||
|
||||
oldName := "first_name" + t.Name()
|
||||
cID := container.Run(t, ctx, client, container.WithName(oldName), container.WithCmd("sh"))
|
||||
@@ -74,7 +73,7 @@ func TestRenameStoppedContainer(t *testing.T) {
|
||||
func TestRenameRunningContainerAndReuse(t *testing.T) {
|
||||
defer setupTest(t)()
|
||||
ctx := context.Background()
|
||||
client := request.NewAPIClient(t)
|
||||
client := testEnv.APIClient()
|
||||
|
||||
oldName := "first_name" + t.Name()
|
||||
cID := container.Run(t, ctx, client, container.WithName(oldName))
|
||||
@@ -102,7 +101,7 @@ func TestRenameRunningContainerAndReuse(t *testing.T) {
|
||||
func TestRenameInvalidName(t *testing.T) {
|
||||
defer setupTest(t)()
|
||||
ctx := context.Background()
|
||||
client := request.NewAPIClient(t)
|
||||
client := testEnv.APIClient()
|
||||
|
||||
oldName := "first_name" + t.Name()
|
||||
cID := container.Run(t, ctx, client, container.WithName(oldName))
|
||||
@@ -127,7 +126,7 @@ func TestRenameAnonymousContainer(t *testing.T) {
|
||||
skip.If(t, testEnv.OSType == "windows", "FIXME")
|
||||
defer setupTest(t)()
|
||||
ctx := context.Background()
|
||||
client := request.NewAPIClient(t)
|
||||
client := testEnv.APIClient()
|
||||
|
||||
networkName := "network1" + t.Name()
|
||||
_, err := client.NetworkCreate(ctx, networkName, types.NetworkCreate{})
|
||||
@@ -173,7 +172,7 @@ func TestRenameAnonymousContainer(t *testing.T) {
|
||||
func TestRenameContainerWithSameName(t *testing.T) {
|
||||
defer setupTest(t)()
|
||||
ctx := context.Background()
|
||||
client := request.NewAPIClient(t)
|
||||
client := testEnv.APIClient()
|
||||
|
||||
oldName := "old" + t.Name()
|
||||
cID := container.Run(t, ctx, client, container.WithName(oldName))
|
||||
@@ -196,7 +195,7 @@ func TestRenameContainerWithLinkedContainer(t *testing.T) {
|
||||
|
||||
defer setupTest(t)()
|
||||
ctx := context.Background()
|
||||
client := request.NewAPIClient(t)
|
||||
client := testEnv.APIClient()
|
||||
|
||||
db1Name := "db1" + t.Name()
|
||||
db1ID := container.Run(t, ctx, client, container.WithName(db1Name))
|
||||
|
||||
@@ -9,7 +9,6 @@ import (
|
||||
"github.com/docker/docker/api/types"
|
||||
"github.com/docker/docker/api/types/versions"
|
||||
"github.com/docker/docker/integration/internal/container"
|
||||
"github.com/docker/docker/internal/test/request"
|
||||
req "github.com/docker/docker/internal/test/request"
|
||||
"gotest.tools/assert"
|
||||
is "gotest.tools/assert/cmp"
|
||||
@@ -20,7 +19,7 @@ import (
|
||||
func TestResize(t *testing.T) {
|
||||
skip.If(t, testEnv.OSType == "windows", "FIXME")
|
||||
defer setupTest(t)()
|
||||
client := request.NewAPIClient(t)
|
||||
client := testEnv.APIClient()
|
||||
ctx := context.Background()
|
||||
|
||||
cID := container.Run(t, ctx, client)
|
||||
@@ -38,7 +37,7 @@ func TestResizeWithInvalidSize(t *testing.T) {
|
||||
skip.If(t, versions.LessThan(testEnv.DaemonAPIVersion(), "1.32"), "broken in earlier versions")
|
||||
skip.If(t, testEnv.OSType == "windows", "FIXME")
|
||||
defer setupTest(t)()
|
||||
client := request.NewAPIClient(t)
|
||||
client := testEnv.APIClient()
|
||||
ctx := context.Background()
|
||||
|
||||
cID := container.Run(t, ctx, client)
|
||||
@@ -53,7 +52,7 @@ func TestResizeWithInvalidSize(t *testing.T) {
|
||||
|
||||
func TestResizeWhenContainerNotStarted(t *testing.T) {
|
||||
defer setupTest(t)()
|
||||
client := request.NewAPIClient(t)
|
||||
client := testEnv.APIClient()
|
||||
ctx := context.Background()
|
||||
|
||||
cID := container.Run(t, ctx, client, container.WithCmd("echo"))
|
||||
|
||||
@@ -9,7 +9,6 @@ import (
|
||||
|
||||
"github.com/docker/docker/api/types"
|
||||
"github.com/docker/docker/integration/internal/container"
|
||||
"github.com/docker/docker/internal/test/request"
|
||||
"gotest.tools/assert"
|
||||
is "gotest.tools/assert/cmp"
|
||||
"gotest.tools/poll"
|
||||
@@ -20,7 +19,7 @@ func TestStats(t *testing.T) {
|
||||
skip.If(t, !testEnv.DaemonInfo.MemoryLimit)
|
||||
|
||||
defer setupTest(t)()
|
||||
client := request.NewAPIClient(t)
|
||||
client := testEnv.APIClient()
|
||||
ctx := context.Background()
|
||||
|
||||
info, err := client.Info(ctx)
|
||||
|
||||
@@ -10,7 +10,6 @@ import (
|
||||
|
||||
"github.com/docker/docker/api/types"
|
||||
"github.com/docker/docker/integration/internal/container"
|
||||
"github.com/docker/docker/internal/test/request"
|
||||
"gotest.tools/assert"
|
||||
"gotest.tools/icmd"
|
||||
"gotest.tools/poll"
|
||||
@@ -22,7 +21,7 @@ import (
|
||||
// waiting is not limited (issue #35311).
|
||||
func TestStopContainerWithTimeout(t *testing.T) {
|
||||
defer setupTest(t)()
|
||||
client := request.NewAPIClient(t)
|
||||
client := testEnv.APIClient()
|
||||
ctx := context.Background()
|
||||
|
||||
testCmd := container.WithCmd("sh", "-c", "sleep 2 && exit 42")
|
||||
@@ -76,7 +75,7 @@ func TestDeleteDevicemapper(t *testing.T) {
|
||||
skip.If(t, testEnv.IsRemoteDaemon, "cannot start daemon on remote test run")
|
||||
|
||||
defer setupTest(t)()
|
||||
client := request.NewAPIClient(t)
|
||||
client := testEnv.APIClient()
|
||||
ctx := context.Background()
|
||||
|
||||
id := container.Run(t, ctx, client, container.WithName("foo-"+t.Name()), container.WithCmd("echo"))
|
||||
|
||||
@@ -6,14 +6,13 @@ import (
|
||||
"time"
|
||||
|
||||
"github.com/docker/docker/integration/internal/container"
|
||||
"github.com/docker/docker/internal/test/request"
|
||||
"gotest.tools/assert"
|
||||
"gotest.tools/poll"
|
||||
)
|
||||
|
||||
func TestStopContainerWithRestartPolicyAlways(t *testing.T) {
|
||||
defer setupTest(t)()
|
||||
client := request.NewAPIClient(t)
|
||||
client := testEnv.APIClient()
|
||||
ctx := context.Background()
|
||||
|
||||
names := []string{"verifyRestart1-" + t.Name(), "verifyRestart2-" + t.Name()}
|
||||
|
||||
@@ -7,7 +7,6 @@ import (
|
||||
"time"
|
||||
|
||||
"github.com/docker/docker/integration/internal/container"
|
||||
"github.com/docker/docker/internal/test/request"
|
||||
"gotest.tools/assert"
|
||||
"gotest.tools/poll"
|
||||
"gotest.tools/skip"
|
||||
@@ -19,7 +18,7 @@ import (
|
||||
func TestStopContainerWithTimeout(t *testing.T) {
|
||||
skip.If(t, testEnv.OSType == "windows")
|
||||
defer setupTest(t)()
|
||||
client := request.NewAPIClient(t)
|
||||
client := testEnv.APIClient()
|
||||
ctx := context.Background()
|
||||
|
||||
testCmd := container.WithCmd("sh", "-c", "sleep 2 && exit 42")
|
||||
|
||||
@@ -9,7 +9,6 @@ import (
|
||||
|
||||
containertypes "github.com/docker/docker/api/types/container"
|
||||
"github.com/docker/docker/integration/internal/container"
|
||||
"github.com/docker/docker/internal/test/request"
|
||||
"gotest.tools/assert"
|
||||
is "gotest.tools/assert/cmp"
|
||||
"gotest.tools/poll"
|
||||
@@ -22,7 +21,7 @@ func TestUpdateMemory(t *testing.T) {
|
||||
skip.If(t, !testEnv.DaemonInfo.SwapLimit)
|
||||
|
||||
defer setupTest(t)()
|
||||
client := request.NewAPIClient(t)
|
||||
client := testEnv.APIClient()
|
||||
ctx := context.Background()
|
||||
|
||||
cID := container.Run(t, ctx, client, func(c *container.TestContainerConfig) {
|
||||
@@ -68,7 +67,7 @@ func TestUpdateMemory(t *testing.T) {
|
||||
|
||||
func TestUpdateCPUQuota(t *testing.T) {
|
||||
defer setupTest(t)()
|
||||
client := request.NewAPIClient(t)
|
||||
client := testEnv.APIClient()
|
||||
ctx := context.Background()
|
||||
|
||||
cID := container.Run(t, ctx, client)
|
||||
|
||||
@@ -7,7 +7,6 @@ import (
|
||||
|
||||
containertypes "github.com/docker/docker/api/types/container"
|
||||
"github.com/docker/docker/integration/internal/container"
|
||||
"github.com/docker/docker/internal/test/request"
|
||||
"gotest.tools/assert"
|
||||
is "gotest.tools/assert/cmp"
|
||||
"gotest.tools/poll"
|
||||
@@ -15,7 +14,7 @@ import (
|
||||
|
||||
func TestUpdateRestartPolicy(t *testing.T) {
|
||||
defer setupTest(t)()
|
||||
client := request.NewAPIClient(t)
|
||||
client := testEnv.APIClient()
|
||||
ctx := context.Background()
|
||||
|
||||
cID := container.Run(t, ctx, client, container.WithCmd("sh", "-c", "sleep 1 && false"), func(c *container.TestContainerConfig) {
|
||||
@@ -48,7 +47,7 @@ func TestUpdateRestartPolicy(t *testing.T) {
|
||||
|
||||
func TestUpdateRestartWithAutoRemove(t *testing.T) {
|
||||
defer setupTest(t)()
|
||||
client := request.NewAPIClient(t)
|
||||
client := testEnv.APIClient()
|
||||
ctx := context.Background()
|
||||
|
||||
cID := container.Run(t, ctx, client, func(c *container.TestContainerConfig) {
|
||||
|
||||
Reference in New Issue
Block a user