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>
| ... | ... |
@@ -15,7 +15,6 @@ import ( |
| 15 | 15 |
"github.com/docker/docker/api/types/filters" |
| 16 | 16 |
"github.com/docker/docker/api/types/versions" |
| 17 | 17 |
"github.com/docker/docker/internal/test/fakecontext" |
| 18 |
- "github.com/docker/docker/internal/test/request" |
|
| 19 | 18 |
"github.com/docker/docker/pkg/jsonmessage" |
| 20 | 19 |
"gotest.tools/assert" |
| 21 | 20 |
is "gotest.tools/assert/cmp" |
| ... | ... |
@@ -89,7 +88,7 @@ func TestBuildWithRemoveAndForceRemove(t *testing.T) {
|
| 89 | 89 |
}, |
| 90 | 90 |
} |
| 91 | 91 |
|
| 92 |
- client := request.NewAPIClient(t) |
|
| 92 |
+ client := testEnv.APIClient() |
|
| 93 | 93 |
ctx := context.Background() |
| 94 | 94 |
for _, c := range cases {
|
| 95 | 95 |
t.Run(c.name, func(t *testing.T) {
|
| ... | ... |
@@ -24,7 +24,7 @@ import ( |
| 24 | 24 |
|
| 25 | 25 |
func TestCreateFailsWhenIdentifierDoesNotExist(t *testing.T) {
|
| 26 | 26 |
defer setupTest(t)() |
| 27 |
- client := request.NewAPIClient(t) |
|
| 27 |
+ client := testEnv.APIClient() |
|
| 28 | 28 |
|
| 29 | 29 |
testCases := []struct {
|
| 30 | 30 |
doc string |
| ... | ... |
@@ -65,7 +65,7 @@ func TestCreateFailsWhenIdentifierDoesNotExist(t *testing.T) {
|
| 65 | 65 |
|
| 66 | 66 |
func TestCreateWithInvalidEnv(t *testing.T) {
|
| 67 | 67 |
defer setupTest(t)() |
| 68 |
- client := request.NewAPIClient(t) |
|
| 68 |
+ client := testEnv.APIClient() |
|
| 69 | 69 |
|
| 70 | 70 |
testCases := []struct {
|
| 71 | 71 |
env string |
| ... | ... |
@@ -108,7 +108,7 @@ func TestCreateTmpfsMountsTarget(t *testing.T) {
|
| 108 | 108 |
skip.If(t, testEnv.DaemonInfo.OSType == "windows") |
| 109 | 109 |
|
| 110 | 110 |
defer setupTest(t)() |
| 111 |
- client := request.NewAPIClient(t) |
|
| 111 |
+ client := testEnv.APIClient() |
|
| 112 | 112 |
|
| 113 | 113 |
testCases := []struct {
|
| 114 | 114 |
target string |
| ... | ... |
@@ -150,7 +150,7 @@ func TestCreateWithCustomMaskedPaths(t *testing.T) {
|
| 150 | 150 |
skip.If(t, testEnv.DaemonInfo.OSType != "linux") |
| 151 | 151 |
|
| 152 | 152 |
defer setupTest(t)() |
| 153 |
- client := request.NewAPIClient(t) |
|
| 153 |
+ client := testEnv.APIClient() |
|
| 154 | 154 |
ctx := context.Background() |
| 155 | 155 |
|
| 156 | 156 |
testCases := []struct {
|
| ... | ... |
@@ -229,7 +229,7 @@ func TestCreateWithCustomReadonlyPaths(t *testing.T) {
|
| 229 | 229 |
skip.If(t, testEnv.DaemonInfo.OSType != "linux") |
| 230 | 230 |
|
| 231 | 231 |
defer setupTest(t)() |
| 232 |
- client := request.NewAPIClient(t) |
|
| 232 |
+ client := testEnv.APIClient() |
|
| 233 | 233 |
ctx := context.Background() |
| 234 | 234 |
|
| 235 | 235 |
testCases := []struct {
|
| ... | ... |
@@ -7,7 +7,6 @@ import ( |
| 7 | 7 |
|
| 8 | 8 |
containertypes "github.com/docker/docker/api/types/container" |
| 9 | 9 |
"github.com/docker/docker/integration/internal/container" |
| 10 |
- "github.com/docker/docker/internal/test/request" |
|
| 11 | 10 |
"github.com/docker/docker/pkg/archive" |
| 12 | 11 |
"gotest.tools/assert" |
| 13 | 12 |
"gotest.tools/poll" |
| ... | ... |
@@ -17,7 +16,7 @@ import ( |
| 17 | 17 |
func TestDiff(t *testing.T) {
|
| 18 | 18 |
skip.If(t, testEnv.OSType == "windows", "FIXME") |
| 19 | 19 |
defer setupTest(t)() |
| 20 |
- client := request.NewAPIClient(t) |
|
| 20 |
+ client := testEnv.APIClient() |
|
| 21 | 21 |
ctx := context.Background() |
| 22 | 22 |
|
| 23 | 23 |
cID := container.Run(t, ctx, client, container.WithCmd("sh", "-c", `mkdir /foo; echo xyzzy > /foo/bar`))
|
| ... | ... |
@@ -10,7 +10,6 @@ import ( |
| 10 | 10 |
"github.com/docker/docker/api/types/strslice" |
| 11 | 11 |
"github.com/docker/docker/api/types/versions" |
| 12 | 12 |
"github.com/docker/docker/integration/internal/container" |
| 13 |
- "github.com/docker/docker/internal/test/request" |
|
| 14 | 13 |
"gotest.tools/assert" |
| 15 | 14 |
is "gotest.tools/assert/cmp" |
| 16 | 15 |
"gotest.tools/skip" |
| ... | ... |
@@ -22,7 +21,7 @@ func TestExecWithCloseStdin(t *testing.T) {
|
| 22 | 22 |
defer setupTest(t)() |
| 23 | 23 |
|
| 24 | 24 |
ctx := context.Background() |
| 25 |
- client := request.NewAPIClient(t) |
|
| 25 |
+ client := testEnv.APIClient() |
|
| 26 | 26 |
|
| 27 | 27 |
// run top with detached mode |
| 28 | 28 |
cID := container.Run(t, ctx, client) |
| ... | ... |
@@ -89,7 +88,7 @@ func TestExec(t *testing.T) {
|
| 89 | 89 |
skip.If(t, testEnv.OSType == "windows", "FIXME. Probably needs to wait for container to be in running state.") |
| 90 | 90 |
defer setupTest(t)() |
| 91 | 91 |
ctx := context.Background() |
| 92 |
- client := request.NewAPIClient(t) |
|
| 92 |
+ client := testEnv.APIClient() |
|
| 93 | 93 |
|
| 94 | 94 |
cID := container.Run(t, ctx, client, container.WithTty(true), container.WithWorkingDir("/root"))
|
| 95 | 95 |
|
| ... | ... |
@@ -10,7 +10,6 @@ import ( |
| 10 | 10 |
"github.com/docker/docker/api/types/filters" |
| 11 | 11 |
"github.com/docker/docker/integration/internal/container" |
| 12 | 12 |
"github.com/docker/docker/internal/test/daemon" |
| 13 |
- "github.com/docker/docker/internal/test/request" |
|
| 14 | 13 |
"github.com/docker/docker/pkg/jsonmessage" |
| 15 | 14 |
"gotest.tools/assert" |
| 16 | 15 |
is "gotest.tools/assert/cmp" |
| ... | ... |
@@ -23,7 +22,7 @@ func TestExportContainerAndImportImage(t *testing.T) {
|
| 23 | 23 |
skip.If(t, testEnv.DaemonInfo.OSType == "windows") |
| 24 | 24 |
|
| 25 | 25 |
defer setupTest(t)() |
| 26 |
- client := request.NewAPIClient(t) |
|
| 26 |
+ client := testEnv.APIClient() |
|
| 27 | 27 |
ctx := context.Background() |
| 28 | 28 |
|
| 29 | 29 |
cID := container.Run(t, ctx, client, container.WithCmd("true"))
|
| ... | ... |
@@ -9,7 +9,6 @@ import ( |
| 9 | 9 |
containertypes "github.com/docker/docker/api/types/container" |
| 10 | 10 |
"github.com/docker/docker/client" |
| 11 | 11 |
"github.com/docker/docker/integration/internal/container" |
| 12 |
- "github.com/docker/docker/internal/test/request" |
|
| 13 | 12 |
"gotest.tools/poll" |
| 14 | 13 |
"gotest.tools/skip" |
| 15 | 14 |
) |
| ... | ... |
@@ -20,7 +19,7 @@ func TestHealthCheckWorkdir(t *testing.T) {
|
| 20 | 20 |
skip.If(t, testEnv.OSType == "windows", "FIXME") |
| 21 | 21 |
defer setupTest(t)() |
| 22 | 22 |
ctx := context.Background() |
| 23 |
- client := request.NewAPIClient(t) |
|
| 23 |
+ client := testEnv.APIClient() |
|
| 24 | 24 |
|
| 25 | 25 |
cID := container.Run(t, ctx, client, container.WithTty(true), container.WithWorkingDir("/foo"), func(c *container.TestContainerConfig) {
|
| 26 | 26 |
c.Config.Healthcheck = &containertypes.HealthConfig{
|
| ... | ... |
@@ -13,7 +13,6 @@ import ( |
| 13 | 13 |
containertypes "github.com/docker/docker/api/types/container" |
| 14 | 14 |
"github.com/docker/docker/integration/internal/container" |
| 15 | 15 |
"github.com/docker/docker/internal/test/daemon" |
| 16 |
- "github.com/docker/docker/internal/test/request" |
|
| 17 | 16 |
"gotest.tools/assert" |
| 18 | 17 |
is "gotest.tools/assert/cmp" |
| 19 | 18 |
"gotest.tools/fs" |
| ... | ... |
@@ -61,7 +60,7 @@ func testIpcNonePrivateShareable(t *testing.T, mode string, mustBeMounted bool, |
| 61 | 61 |
hostCfg := containertypes.HostConfig{
|
| 62 | 62 |
IpcMode: containertypes.IpcMode(mode), |
| 63 | 63 |
} |
| 64 |
- client := request.NewAPIClient(t) |
|
| 64 |
+ client := testEnv.APIClient() |
|
| 65 | 65 |
ctx := context.Background() |
| 66 | 66 |
|
| 67 | 67 |
resp, err := client.ContainerCreate(ctx, &cfg, &hostCfg, nil, "") |
| ... | ... |
@@ -132,7 +131,7 @@ func testIpcContainer(t *testing.T, donorMode string, mustWork bool) {
|
| 132 | 132 |
IpcMode: containertypes.IpcMode(donorMode), |
| 133 | 133 |
} |
| 134 | 134 |
ctx := context.Background() |
| 135 |
- client := request.NewAPIClient(t) |
|
| 135 |
+ client := testEnv.APIClient() |
|
| 136 | 136 |
|
| 137 | 137 |
// create and start the "donor" container |
| 138 | 138 |
resp, err := client.ContainerCreate(ctx, &cfg, &hostCfg, nil, "") |
| ... | ... |
@@ -17,7 +17,7 @@ import ( |
| 17 | 17 |
|
| 18 | 18 |
func TestKillContainerInvalidSignal(t *testing.T) {
|
| 19 | 19 |
defer setupTest(t)() |
| 20 |
- client := request.NewAPIClient(t) |
|
| 20 |
+ client := testEnv.APIClient() |
|
| 21 | 21 |
ctx := context.Background() |
| 22 | 22 |
id := container.Run(t, ctx, client) |
| 23 | 23 |
|
| ... | ... |
@@ -33,7 +33,7 @@ func TestKillContainerInvalidSignal(t *testing.T) {
|
| 33 | 33 |
func TestKillContainer(t *testing.T) {
|
| 34 | 34 |
skip.If(t, testEnv.OSType == "windows", "TODO Windows: FIXME. No SIGWINCH") |
| 35 | 35 |
defer setupTest(t)() |
| 36 |
- client := request.NewAPIClient(t) |
|
| 36 |
+ client := testEnv.APIClient() |
|
| 37 | 37 |
|
| 38 | 38 |
testCases := []struct {
|
| 39 | 39 |
doc string |
| ... | ... |
@@ -73,7 +73,7 @@ func TestKillContainer(t *testing.T) {
|
| 73 | 73 |
func TestKillWithStopSignalAndRestartPolicies(t *testing.T) {
|
| 74 | 74 |
skip.If(t, testEnv.OSType == "windows", "Windows only supports 1.25 or later") |
| 75 | 75 |
defer setupTest(t)() |
| 76 |
- client := request.NewAPIClient(t) |
|
| 76 |
+ client := testEnv.APIClient() |
|
| 77 | 77 |
|
| 78 | 78 |
testCases := []struct {
|
| 79 | 79 |
doc string |
| ... | ... |
@@ -114,7 +114,7 @@ func TestKillStoppedContainer(t *testing.T) {
|
| 114 | 114 |
skip.If(t, testEnv.OSType == "windows", "Windows only supports 1.25 or later") |
| 115 | 115 |
defer setupTest(t)() |
| 116 | 116 |
ctx := context.Background() |
| 117 |
- client := request.NewAPIClient(t) |
|
| 117 |
+ client := testEnv.APIClient() |
|
| 118 | 118 |
id := container.Create(t, ctx, client) |
| 119 | 119 |
err := client.ContainerKill(ctx, id, "SIGKILL") |
| 120 | 120 |
assert.Assert(t, is.ErrorContains(err, "")) |
| ... | ... |
@@ -154,7 +154,7 @@ func TestInspectOomKilledTrue(t *testing.T) {
|
| 154 | 154 |
|
| 155 | 155 |
defer setupTest(t)() |
| 156 | 156 |
ctx := context.Background() |
| 157 |
- client := request.NewAPIClient(t) |
|
| 157 |
+ client := testEnv.APIClient() |
|
| 158 | 158 |
|
| 159 | 159 |
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) {
|
| 160 | 160 |
c.HostConfig.Resources.Memory = 32 * 1024 * 1024 |
| ... | ... |
@@ -172,7 +172,7 @@ func TestInspectOomKilledFalse(t *testing.T) {
|
| 172 | 172 |
|
| 173 | 173 |
defer setupTest(t)() |
| 174 | 174 |
ctx := context.Background() |
| 175 |
- client := request.NewAPIClient(t) |
|
| 175 |
+ client := testEnv.APIClient() |
|
| 176 | 176 |
|
| 177 | 177 |
cID := container.Run(t, ctx, client, container.WithCmd("sh", "-c", "echo hello world"))
|
| 178 | 178 |
|
| ... | ... |
@@ -9,7 +9,6 @@ import ( |
| 9 | 9 |
"github.com/docker/docker/api/types" |
| 10 | 10 |
"github.com/docker/docker/api/types/filters" |
| 11 | 11 |
"github.com/docker/docker/integration/internal/container" |
| 12 |
- "github.com/docker/docker/internal/test/request" |
|
| 13 | 12 |
"gotest.tools/assert" |
| 14 | 13 |
is "gotest.tools/assert/cmp" |
| 15 | 14 |
"gotest.tools/skip" |
| ... | ... |
@@ -22,7 +21,7 @@ func TestLinksEtcHostsContentMatch(t *testing.T) {
|
| 22 | 22 |
skip.If(t, os.IsNotExist(err)) |
| 23 | 23 |
|
| 24 | 24 |
defer setupTest(t)() |
| 25 |
- client := request.NewAPIClient(t) |
|
| 25 |
+ client := testEnv.APIClient() |
|
| 26 | 26 |
ctx := context.Background() |
| 27 | 27 |
|
| 28 | 28 |
cID := container.Run(t, ctx, client, container.WithNetworkMode("host"))
|
| ... | ... |
@@ -38,7 +37,7 @@ func TestLinksContainerNames(t *testing.T) {
|
| 38 | 38 |
skip.If(t, testEnv.DaemonInfo.OSType == "windows") |
| 39 | 39 |
|
| 40 | 40 |
defer setupTest(t)() |
| 41 |
- client := request.NewAPIClient(t) |
|
| 41 |
+ client := testEnv.APIClient() |
|
| 42 | 42 |
ctx := context.Background() |
| 43 | 43 |
|
| 44 | 44 |
containerA := "first_" + t.Name() |
| ... | ... |
@@ -7,7 +7,6 @@ import ( |
| 7 | 7 |
|
| 8 | 8 |
"github.com/docker/docker/api/types" |
| 9 | 9 |
"github.com/docker/docker/integration/internal/container" |
| 10 |
- "github.com/docker/docker/internal/test/request" |
|
| 11 | 10 |
"github.com/docker/docker/pkg/stdcopy" |
| 12 | 11 |
"gotest.tools/assert" |
| 13 | 12 |
"gotest.tools/skip" |
| ... | ... |
@@ -19,7 +18,7 @@ func TestLogsFollowTailEmpty(t *testing.T) {
|
| 19 | 19 |
// FIXME(vdemeester) fails on a e2e run on linux... |
| 20 | 20 |
skip.If(t, testEnv.IsRemoteDaemon()) |
| 21 | 21 |
defer setupTest(t)() |
| 22 |
- client := request.NewAPIClient(t) |
|
| 22 |
+ client := testEnv.APIClient() |
|
| 23 | 23 |
ctx := context.Background() |
| 24 | 24 |
|
| 25 | 25 |
id := container.Run(t, ctx, client, container.WithCmd("sleep", "100000"))
|
| ... | ... |
@@ -14,7 +14,6 @@ import ( |
| 14 | 14 |
"github.com/docker/docker/api/types/versions" |
| 15 | 15 |
"github.com/docker/docker/client" |
| 16 | 16 |
"github.com/docker/docker/integration/internal/container" |
| 17 |
- "github.com/docker/docker/internal/test/request" |
|
| 18 | 17 |
"github.com/docker/docker/pkg/mount" |
| 19 | 18 |
"github.com/docker/docker/pkg/system" |
| 20 | 19 |
"gotest.tools/assert" |
| ... | ... |
@@ -87,9 +86,9 @@ func TestContainerNetworkMountsNoChown(t *testing.T) {
|
| 87 | 87 |
|
| 88 | 88 |
func TestMountDaemonRoot(t *testing.T) {
|
| 89 | 89 |
skip.If(t, testEnv.DaemonInfo.OSType == "windows" || testEnv.IsRemoteDaemon()) |
| 90 |
- t.Parallel() |
|
| 91 | 90 |
|
| 92 |
- client := request.NewAPIClient(t) |
|
| 91 |
+ defer setupTest(t)() |
|
| 92 |
+ client := testEnv.APIClient() |
|
| 93 | 93 |
ctx := context.Background() |
| 94 | 94 |
info, err := client.Info(ctx) |
| 95 | 95 |
if err != nil {
|
| ... | ... |
@@ -255,7 +254,7 @@ func TestContainerBindMountNonRecursive(t *testing.T) {
|
| 255 | 255 |
nonRecursiveVerifier := []string{"test", "!", "-f", "/foo/mnt/file"}
|
| 256 | 256 |
|
| 257 | 257 |
ctx := context.Background() |
| 258 |
- client := request.NewAPIClient(t) |
|
| 258 |
+ client := testEnv.APIClient() |
|
| 259 | 259 |
containers := []string{
|
| 260 | 260 |
container.Run(t, ctx, client, container.WithMount(implicit), container.WithCmd(recursiveVerifier...)), |
| 261 | 261 |
container.Run(t, ctx, client, container.WithMount(recursive), container.WithCmd(recursiveVerifier...)), |
| ... | ... |
@@ -13,7 +13,6 @@ import ( |
| 13 | 13 |
|
| 14 | 14 |
"github.com/docker/docker/api/types" |
| 15 | 15 |
"github.com/docker/docker/integration/internal/container" |
| 16 |
- "github.com/docker/docker/internal/test/request" |
|
| 17 | 16 |
"github.com/docker/go-connections/nat" |
| 18 | 17 |
"gotest.tools/assert" |
| 19 | 18 |
is "gotest.tools/assert/cmp" |
| ... | ... |
@@ -22,6 +21,7 @@ import ( |
| 22 | 22 |
) |
| 23 | 23 |
|
| 24 | 24 |
func TestNetworkNat(t *testing.T) {
|
| 25 |
+ skip.If(t, testEnv.OSType == "windows", "FIXME") |
|
| 25 | 26 |
skip.If(t, testEnv.IsRemoteDaemon()) |
| 26 | 27 |
|
| 27 | 28 |
defer setupTest(t)() |
| ... | ... |
@@ -58,6 +58,7 @@ func TestNetworkLocalhostTCPNat(t *testing.T) {
|
| 58 | 58 |
} |
| 59 | 59 |
|
| 60 | 60 |
func TestNetworkLoopbackNat(t *testing.T) {
|
| 61 |
+ skip.If(t, testEnv.OSType == "windows", "FIXME") |
|
| 61 | 62 |
skip.If(t, testEnv.IsRemoteDaemon()) |
| 62 | 63 |
|
| 63 | 64 |
defer setupTest(t)() |
| ... | ... |
@@ -67,7 +68,7 @@ func TestNetworkLoopbackNat(t *testing.T) {
|
| 67 | 67 |
|
| 68 | 68 |
endpoint := getExternalAddress(t) |
| 69 | 69 |
|
| 70 |
- client := request.NewAPIClient(t) |
|
| 70 |
+ client := testEnv.APIClient() |
|
| 71 | 71 |
ctx := context.Background() |
| 72 | 72 |
|
| 73 | 73 |
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) {
|
| 88 | 88 |
} |
| 89 | 89 |
|
| 90 | 90 |
func startServerContainer(t *testing.T, msg string, port int) string {
|
| 91 |
- client := request.NewAPIClient(t) |
|
| 91 |
+ t.Helper() |
|
| 92 |
+ client := testEnv.APIClient() |
|
| 92 | 93 |
ctx := context.Background() |
| 93 | 94 |
|
| 94 | 95 |
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 {
|
| 107 | 107 |
} |
| 108 | 108 |
|
| 109 | 109 |
func getExternalAddress(t *testing.T) net.IP {
|
| 110 |
- skip.If(t, testEnv.OSType == "windows", "FIXME") |
|
| 110 |
+ t.Helper() |
|
| 111 | 111 |
iface, err := net.InterfaceByName("eth0")
|
| 112 | 112 |
skip.If(t, err != nil, "Test not running with `make test-integration`. Interface eth0 not found: %s", err) |
| 113 | 113 |
|
| ... | ... |
@@ -22,7 +22,7 @@ func TestPause(t *testing.T) {
|
| 22 | 22 |
skip.If(t, testEnv.DaemonInfo.OSType == "windows" && testEnv.DaemonInfo.Isolation == "process") |
| 23 | 23 |
|
| 24 | 24 |
defer setupTest(t)() |
| 25 |
- client := request.NewAPIClient(t) |
|
| 25 |
+ client := testEnv.APIClient() |
|
| 26 | 26 |
ctx := context.Background() |
| 27 | 27 |
|
| 28 | 28 |
cID := container.Run(t, ctx, client) |
| ... | ... |
@@ -54,7 +54,7 @@ func TestPauseFailsOnWindowsServerContainers(t *testing.T) {
|
| 54 | 54 |
skip.If(t, testEnv.DaemonInfo.OSType != "windows" || testEnv.DaemonInfo.Isolation != "process") |
| 55 | 55 |
|
| 56 | 56 |
defer setupTest(t)() |
| 57 |
- client := request.NewAPIClient(t) |
|
| 57 |
+ client := testEnv.APIClient() |
|
| 58 | 58 |
ctx := context.Background() |
| 59 | 59 |
|
| 60 | 60 |
cID := container.Run(t, ctx, client) |
| ... | ... |
@@ -68,7 +68,7 @@ func TestPauseStopPausedContainer(t *testing.T) {
|
| 68 | 68 |
skip.If(t, testEnv.DaemonInfo.OSType == "windows") |
| 69 | 69 |
skip.If(t, versions.LessThan(testEnv.DaemonAPIVersion(), "1.31"), "broken in earlier versions") |
| 70 | 70 |
defer setupTest(t)() |
| 71 |
- client := request.NewAPIClient(t) |
|
| 71 |
+ client := testEnv.APIClient() |
|
| 72 | 72 |
ctx := context.Background() |
| 73 | 73 |
|
| 74 | 74 |
cID := container.Run(t, ctx, client) |
| ... | ... |
@@ -7,14 +7,13 @@ import ( |
| 7 | 7 |
"github.com/docker/docker/api/types" |
| 8 | 8 |
"github.com/docker/docker/api/types/filters" |
| 9 | 9 |
"github.com/docker/docker/integration/internal/container" |
| 10 |
- "github.com/docker/docker/internal/test/request" |
|
| 11 | 10 |
"gotest.tools/assert" |
| 12 | 11 |
is "gotest.tools/assert/cmp" |
| 13 | 12 |
) |
| 14 | 13 |
|
| 15 | 14 |
func TestPsFilter(t *testing.T) {
|
| 16 | 15 |
defer setupTest(t)() |
| 17 |
- client := request.NewAPIClient(t) |
|
| 16 |
+ client := testEnv.APIClient() |
|
| 18 | 17 |
ctx := context.Background() |
| 19 | 18 |
|
| 20 | 19 |
prev := container.Create(t, ctx, client) |
| ... | ... |
@@ -9,7 +9,6 @@ import ( |
| 9 | 9 |
"github.com/docker/docker/api/types" |
| 10 | 10 |
"github.com/docker/docker/api/types/filters" |
| 11 | 11 |
"github.com/docker/docker/integration/internal/container" |
| 12 |
- "github.com/docker/docker/internal/test/request" |
|
| 13 | 12 |
"gotest.tools/assert" |
| 14 | 13 |
is "gotest.tools/assert/cmp" |
| 15 | 14 |
"gotest.tools/fs" |
| ... | ... |
@@ -30,7 +29,7 @@ func TestRemoveContainerWithRemovedVolume(t *testing.T) {
|
| 30 | 30 |
|
| 31 | 31 |
defer setupTest(t)() |
| 32 | 32 |
ctx := context.Background() |
| 33 |
- client := request.NewAPIClient(t) |
|
| 33 |
+ client := testEnv.APIClient() |
|
| 34 | 34 |
|
| 35 | 35 |
prefix, slash := getPrefixAndSlashFromDaemonPlatform() |
| 36 | 36 |
|
| ... | ... |
@@ -56,7 +55,7 @@ func TestRemoveContainerWithRemovedVolume(t *testing.T) {
|
| 56 | 56 |
func TestRemoveContainerWithVolume(t *testing.T) {
|
| 57 | 57 |
defer setupTest(t)() |
| 58 | 58 |
ctx := context.Background() |
| 59 |
- client := request.NewAPIClient(t) |
|
| 59 |
+ client := testEnv.APIClient() |
|
| 60 | 60 |
|
| 61 | 61 |
prefix, slash := getPrefixAndSlashFromDaemonPlatform() |
| 62 | 62 |
|
| ... | ... |
@@ -81,7 +80,7 @@ func TestRemoveContainerWithVolume(t *testing.T) {
|
| 81 | 81 |
func TestRemoveContainerRunning(t *testing.T) {
|
| 82 | 82 |
defer setupTest(t)() |
| 83 | 83 |
ctx := context.Background() |
| 84 |
- client := request.NewAPIClient(t) |
|
| 84 |
+ client := testEnv.APIClient() |
|
| 85 | 85 |
|
| 86 | 86 |
cID := container.Run(t, ctx, client) |
| 87 | 87 |
|
| ... | ... |
@@ -92,7 +91,7 @@ func TestRemoveContainerRunning(t *testing.T) {
|
| 92 | 92 |
func TestRemoveContainerForceRemoveRunning(t *testing.T) {
|
| 93 | 93 |
defer setupTest(t)() |
| 94 | 94 |
ctx := context.Background() |
| 95 |
- client := request.NewAPIClient(t) |
|
| 95 |
+ client := testEnv.APIClient() |
|
| 96 | 96 |
|
| 97 | 97 |
cID := container.Run(t, ctx, client) |
| 98 | 98 |
|
| ... | ... |
@@ -105,7 +104,7 @@ func TestRemoveContainerForceRemoveRunning(t *testing.T) {
|
| 105 | 105 |
func TestRemoveInvalidContainer(t *testing.T) {
|
| 106 | 106 |
defer setupTest(t)() |
| 107 | 107 |
ctx := context.Background() |
| 108 |
- client := request.NewAPIClient(t) |
|
| 108 |
+ client := testEnv.APIClient() |
|
| 109 | 109 |
|
| 110 | 110 |
err := client.ContainerRemove(ctx, "unknown", types.ContainerRemoveOptions{})
|
| 111 | 111 |
assert.Check(t, is.ErrorContains(err, "No such container")) |
| ... | ... |
@@ -10,7 +10,6 @@ import ( |
| 10 | 10 |
"github.com/docker/docker/api/types/network" |
| 11 | 11 |
"github.com/docker/docker/api/types/versions" |
| 12 | 12 |
"github.com/docker/docker/integration/internal/container" |
| 13 |
- "github.com/docker/docker/internal/test/request" |
|
| 14 | 13 |
"github.com/docker/docker/pkg/stringid" |
| 15 | 14 |
"gotest.tools/assert" |
| 16 | 15 |
is "gotest.tools/assert/cmp" |
| ... | ... |
@@ -27,7 +26,7 @@ func TestRenameLinkedContainer(t *testing.T) {
|
| 27 | 27 |
skip.If(t, testEnv.OSType == "windows", "FIXME") |
| 28 | 28 |
defer setupTest(t)() |
| 29 | 29 |
ctx := context.Background() |
| 30 |
- client := request.NewAPIClient(t) |
|
| 30 |
+ client := testEnv.APIClient() |
|
| 31 | 31 |
|
| 32 | 32 |
aName := "a0" + t.Name() |
| 33 | 33 |
bName := "b0" + t.Name() |
| ... | ... |
@@ -52,7 +51,7 @@ func TestRenameLinkedContainer(t *testing.T) {
|
| 52 | 52 |
func TestRenameStoppedContainer(t *testing.T) {
|
| 53 | 53 |
defer setupTest(t)() |
| 54 | 54 |
ctx := context.Background() |
| 55 |
- client := request.NewAPIClient(t) |
|
| 55 |
+ client := testEnv.APIClient() |
|
| 56 | 56 |
|
| 57 | 57 |
oldName := "first_name" + t.Name() |
| 58 | 58 |
cID := container.Run(t, ctx, client, container.WithName(oldName), container.WithCmd("sh"))
|
| ... | ... |
@@ -74,7 +73,7 @@ func TestRenameStoppedContainer(t *testing.T) {
|
| 74 | 74 |
func TestRenameRunningContainerAndReuse(t *testing.T) {
|
| 75 | 75 |
defer setupTest(t)() |
| 76 | 76 |
ctx := context.Background() |
| 77 |
- client := request.NewAPIClient(t) |
|
| 77 |
+ client := testEnv.APIClient() |
|
| 78 | 78 |
|
| 79 | 79 |
oldName := "first_name" + t.Name() |
| 80 | 80 |
cID := container.Run(t, ctx, client, container.WithName(oldName)) |
| ... | ... |
@@ -102,7 +101,7 @@ func TestRenameRunningContainerAndReuse(t *testing.T) {
|
| 102 | 102 |
func TestRenameInvalidName(t *testing.T) {
|
| 103 | 103 |
defer setupTest(t)() |
| 104 | 104 |
ctx := context.Background() |
| 105 |
- client := request.NewAPIClient(t) |
|
| 105 |
+ client := testEnv.APIClient() |
|
| 106 | 106 |
|
| 107 | 107 |
oldName := "first_name" + t.Name() |
| 108 | 108 |
cID := container.Run(t, ctx, client, container.WithName(oldName)) |
| ... | ... |
@@ -127,7 +126,7 @@ func TestRenameAnonymousContainer(t *testing.T) {
|
| 127 | 127 |
skip.If(t, testEnv.OSType == "windows", "FIXME") |
| 128 | 128 |
defer setupTest(t)() |
| 129 | 129 |
ctx := context.Background() |
| 130 |
- client := request.NewAPIClient(t) |
|
| 130 |
+ client := testEnv.APIClient() |
|
| 131 | 131 |
|
| 132 | 132 |
networkName := "network1" + t.Name() |
| 133 | 133 |
_, err := client.NetworkCreate(ctx, networkName, types.NetworkCreate{})
|
| ... | ... |
@@ -173,7 +172,7 @@ func TestRenameAnonymousContainer(t *testing.T) {
|
| 173 | 173 |
func TestRenameContainerWithSameName(t *testing.T) {
|
| 174 | 174 |
defer setupTest(t)() |
| 175 | 175 |
ctx := context.Background() |
| 176 |
- client := request.NewAPIClient(t) |
|
| 176 |
+ client := testEnv.APIClient() |
|
| 177 | 177 |
|
| 178 | 178 |
oldName := "old" + t.Name() |
| 179 | 179 |
cID := container.Run(t, ctx, client, container.WithName(oldName)) |
| ... | ... |
@@ -196,7 +195,7 @@ func TestRenameContainerWithLinkedContainer(t *testing.T) {
|
| 196 | 196 |
|
| 197 | 197 |
defer setupTest(t)() |
| 198 | 198 |
ctx := context.Background() |
| 199 |
- client := request.NewAPIClient(t) |
|
| 199 |
+ client := testEnv.APIClient() |
|
| 200 | 200 |
|
| 201 | 201 |
db1Name := "db1" + t.Name() |
| 202 | 202 |
db1ID := container.Run(t, ctx, client, container.WithName(db1Name)) |
| ... | ... |
@@ -9,7 +9,6 @@ import ( |
| 9 | 9 |
"github.com/docker/docker/api/types" |
| 10 | 10 |
"github.com/docker/docker/api/types/versions" |
| 11 | 11 |
"github.com/docker/docker/integration/internal/container" |
| 12 |
- "github.com/docker/docker/internal/test/request" |
|
| 13 | 12 |
req "github.com/docker/docker/internal/test/request" |
| 14 | 13 |
"gotest.tools/assert" |
| 15 | 14 |
is "gotest.tools/assert/cmp" |
| ... | ... |
@@ -20,7 +19,7 @@ import ( |
| 20 | 20 |
func TestResize(t *testing.T) {
|
| 21 | 21 |
skip.If(t, testEnv.OSType == "windows", "FIXME") |
| 22 | 22 |
defer setupTest(t)() |
| 23 |
- client := request.NewAPIClient(t) |
|
| 23 |
+ client := testEnv.APIClient() |
|
| 24 | 24 |
ctx := context.Background() |
| 25 | 25 |
|
| 26 | 26 |
cID := container.Run(t, ctx, client) |
| ... | ... |
@@ -38,7 +37,7 @@ func TestResizeWithInvalidSize(t *testing.T) {
|
| 38 | 38 |
skip.If(t, versions.LessThan(testEnv.DaemonAPIVersion(), "1.32"), "broken in earlier versions") |
| 39 | 39 |
skip.If(t, testEnv.OSType == "windows", "FIXME") |
| 40 | 40 |
defer setupTest(t)() |
| 41 |
- client := request.NewAPIClient(t) |
|
| 41 |
+ client := testEnv.APIClient() |
|
| 42 | 42 |
ctx := context.Background() |
| 43 | 43 |
|
| 44 | 44 |
cID := container.Run(t, ctx, client) |
| ... | ... |
@@ -53,7 +52,7 @@ func TestResizeWithInvalidSize(t *testing.T) {
|
| 53 | 53 |
|
| 54 | 54 |
func TestResizeWhenContainerNotStarted(t *testing.T) {
|
| 55 | 55 |
defer setupTest(t)() |
| 56 |
- client := request.NewAPIClient(t) |
|
| 56 |
+ client := testEnv.APIClient() |
|
| 57 | 57 |
ctx := context.Background() |
| 58 | 58 |
|
| 59 | 59 |
cID := container.Run(t, ctx, client, container.WithCmd("echo"))
|
| ... | ... |
@@ -10,7 +10,6 @@ import ( |
| 10 | 10 |
containertypes "github.com/docker/docker/api/types/container" |
| 11 | 11 |
"github.com/docker/docker/api/types/versions" |
| 12 | 12 |
"github.com/docker/docker/integration/internal/container" |
| 13 |
- "github.com/docker/docker/internal/test/request" |
|
| 14 | 13 |
"gotest.tools/assert" |
| 15 | 14 |
is "gotest.tools/assert/cmp" |
| 16 | 15 |
"gotest.tools/poll" |
| ... | ... |
@@ -23,7 +22,7 @@ func TestKernelTCPMemory(t *testing.T) {
|
| 23 | 23 |
skip.If(t, !testEnv.DaemonInfo.KernelMemoryTCP) |
| 24 | 24 |
|
| 25 | 25 |
defer setupTest(t)() |
| 26 |
- client := request.NewAPIClient(t) |
|
| 26 |
+ client := testEnv.APIClient() |
|
| 27 | 27 |
ctx := context.Background() |
| 28 | 28 |
|
| 29 | 29 |
const ( |
| ... | ... |
@@ -54,7 +53,7 @@ func TestNISDomainname(t *testing.T) {
|
| 54 | 54 |
skip.If(t, testEnv.DaemonInfo.OSType != "linux") |
| 55 | 55 |
|
| 56 | 56 |
defer setupTest(t)() |
| 57 |
- client := request.NewAPIClient(t) |
|
| 57 |
+ client := testEnv.APIClient() |
|
| 58 | 58 |
ctx := context.Background() |
| 59 | 59 |
|
| 60 | 60 |
const ( |
| ... | ... |
@@ -9,7 +9,6 @@ import ( |
| 9 | 9 |
|
| 10 | 10 |
"github.com/docker/docker/api/types" |
| 11 | 11 |
"github.com/docker/docker/integration/internal/container" |
| 12 |
- "github.com/docker/docker/internal/test/request" |
|
| 13 | 12 |
"gotest.tools/assert" |
| 14 | 13 |
is "gotest.tools/assert/cmp" |
| 15 | 14 |
"gotest.tools/poll" |
| ... | ... |
@@ -20,7 +19,7 @@ func TestStats(t *testing.T) {
|
| 20 | 20 |
skip.If(t, !testEnv.DaemonInfo.MemoryLimit) |
| 21 | 21 |
|
| 22 | 22 |
defer setupTest(t)() |
| 23 |
- client := request.NewAPIClient(t) |
|
| 23 |
+ client := testEnv.APIClient() |
|
| 24 | 24 |
ctx := context.Background() |
| 25 | 25 |
|
| 26 | 26 |
info, err := client.Info(ctx) |
| ... | ... |
@@ -10,7 +10,6 @@ import ( |
| 10 | 10 |
|
| 11 | 11 |
"github.com/docker/docker/api/types" |
| 12 | 12 |
"github.com/docker/docker/integration/internal/container" |
| 13 |
- "github.com/docker/docker/internal/test/request" |
|
| 14 | 13 |
"gotest.tools/assert" |
| 15 | 14 |
"gotest.tools/icmd" |
| 16 | 15 |
"gotest.tools/poll" |
| ... | ... |
@@ -22,7 +21,7 @@ import ( |
| 22 | 22 |
// waiting is not limited (issue #35311). |
| 23 | 23 |
func TestStopContainerWithTimeout(t *testing.T) {
|
| 24 | 24 |
defer setupTest(t)() |
| 25 |
- client := request.NewAPIClient(t) |
|
| 25 |
+ client := testEnv.APIClient() |
|
| 26 | 26 |
ctx := context.Background() |
| 27 | 27 |
|
| 28 | 28 |
testCmd := container.WithCmd("sh", "-c", "sleep 2 && exit 42")
|
| ... | ... |
@@ -76,7 +75,7 @@ func TestDeleteDevicemapper(t *testing.T) {
|
| 76 | 76 |
skip.If(t, testEnv.IsRemoteDaemon, "cannot start daemon on remote test run") |
| 77 | 77 |
|
| 78 | 78 |
defer setupTest(t)() |
| 79 |
- client := request.NewAPIClient(t) |
|
| 79 |
+ client := testEnv.APIClient() |
|
| 80 | 80 |
ctx := context.Background() |
| 81 | 81 |
|
| 82 | 82 |
id := container.Run(t, ctx, client, container.WithName("foo-"+t.Name()), container.WithCmd("echo"))
|
| ... | ... |
@@ -6,14 +6,13 @@ import ( |
| 6 | 6 |
"time" |
| 7 | 7 |
|
| 8 | 8 |
"github.com/docker/docker/integration/internal/container" |
| 9 |
- "github.com/docker/docker/internal/test/request" |
|
| 10 | 9 |
"gotest.tools/assert" |
| 11 | 10 |
"gotest.tools/poll" |
| 12 | 11 |
) |
| 13 | 12 |
|
| 14 | 13 |
func TestStopContainerWithRestartPolicyAlways(t *testing.T) {
|
| 15 | 14 |
defer setupTest(t)() |
| 16 |
- client := request.NewAPIClient(t) |
|
| 15 |
+ client := testEnv.APIClient() |
|
| 17 | 16 |
ctx := context.Background() |
| 18 | 17 |
|
| 19 | 18 |
names := []string{"verifyRestart1-" + t.Name(), "verifyRestart2-" + t.Name()}
|
| ... | ... |
@@ -7,7 +7,6 @@ import ( |
| 7 | 7 |
"time" |
| 8 | 8 |
|
| 9 | 9 |
"github.com/docker/docker/integration/internal/container" |
| 10 |
- "github.com/docker/docker/internal/test/request" |
|
| 11 | 10 |
"gotest.tools/assert" |
| 12 | 11 |
"gotest.tools/poll" |
| 13 | 12 |
"gotest.tools/skip" |
| ... | ... |
@@ -19,7 +18,7 @@ import ( |
| 19 | 19 |
func TestStopContainerWithTimeout(t *testing.T) {
|
| 20 | 20 |
skip.If(t, testEnv.OSType == "windows") |
| 21 | 21 |
defer setupTest(t)() |
| 22 |
- client := request.NewAPIClient(t) |
|
| 22 |
+ client := testEnv.APIClient() |
|
| 23 | 23 |
ctx := context.Background() |
| 24 | 24 |
|
| 25 | 25 |
testCmd := container.WithCmd("sh", "-c", "sleep 2 && exit 42")
|
| ... | ... |
@@ -9,7 +9,6 @@ import ( |
| 9 | 9 |
|
| 10 | 10 |
containertypes "github.com/docker/docker/api/types/container" |
| 11 | 11 |
"github.com/docker/docker/integration/internal/container" |
| 12 |
- "github.com/docker/docker/internal/test/request" |
|
| 13 | 12 |
"gotest.tools/assert" |
| 14 | 13 |
is "gotest.tools/assert/cmp" |
| 15 | 14 |
"gotest.tools/poll" |
| ... | ... |
@@ -22,7 +21,7 @@ func TestUpdateMemory(t *testing.T) {
|
| 22 | 22 |
skip.If(t, !testEnv.DaemonInfo.SwapLimit) |
| 23 | 23 |
|
| 24 | 24 |
defer setupTest(t)() |
| 25 |
- client := request.NewAPIClient(t) |
|
| 25 |
+ client := testEnv.APIClient() |
|
| 26 | 26 |
ctx := context.Background() |
| 27 | 27 |
|
| 28 | 28 |
cID := container.Run(t, ctx, client, func(c *container.TestContainerConfig) {
|
| ... | ... |
@@ -68,7 +67,7 @@ func TestUpdateMemory(t *testing.T) {
|
| 68 | 68 |
|
| 69 | 69 |
func TestUpdateCPUQuota(t *testing.T) {
|
| 70 | 70 |
defer setupTest(t)() |
| 71 |
- client := request.NewAPIClient(t) |
|
| 71 |
+ client := testEnv.APIClient() |
|
| 72 | 72 |
ctx := context.Background() |
| 73 | 73 |
|
| 74 | 74 |
cID := container.Run(t, ctx, client) |
| ... | ... |
@@ -7,7 +7,6 @@ import ( |
| 7 | 7 |
|
| 8 | 8 |
containertypes "github.com/docker/docker/api/types/container" |
| 9 | 9 |
"github.com/docker/docker/integration/internal/container" |
| 10 |
- "github.com/docker/docker/internal/test/request" |
|
| 11 | 10 |
"gotest.tools/assert" |
| 12 | 11 |
is "gotest.tools/assert/cmp" |
| 13 | 12 |
"gotest.tools/poll" |
| ... | ... |
@@ -15,7 +14,7 @@ import ( |
| 15 | 15 |
|
| 16 | 16 |
func TestUpdateRestartPolicy(t *testing.T) {
|
| 17 | 17 |
defer setupTest(t)() |
| 18 |
- client := request.NewAPIClient(t) |
|
| 18 |
+ client := testEnv.APIClient() |
|
| 19 | 19 |
ctx := context.Background() |
| 20 | 20 |
|
| 21 | 21 |
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) {
|
| 48 | 48 |
|
| 49 | 49 |
func TestUpdateRestartWithAutoRemove(t *testing.T) {
|
| 50 | 50 |
defer setupTest(t)() |
| 51 |
- client := request.NewAPIClient(t) |
|
| 51 |
+ client := testEnv.APIClient() |
|
| 52 | 52 |
ctx := context.Background() |
| 53 | 53 |
|
| 54 | 54 |
cID := container.Run(t, ctx, client, func(c *container.TestContainerConfig) {
|
| ... | ... |
@@ -7,7 +7,6 @@ import ( |
| 7 | 7 |
"github.com/docker/docker/api/types" |
| 8 | 8 |
"github.com/docker/docker/api/types/versions" |
| 9 | 9 |
"github.com/docker/docker/integration/internal/container" |
| 10 |
- "github.com/docker/docker/internal/test/request" |
|
| 11 | 10 |
"gotest.tools/assert" |
| 12 | 11 |
is "gotest.tools/assert/cmp" |
| 13 | 12 |
"gotest.tools/skip" |
| ... | ... |
@@ -17,7 +16,7 @@ func TestCommitInheritsEnv(t *testing.T) {
|
| 17 | 17 |
skip.If(t, versions.LessThan(testEnv.DaemonAPIVersion(), "1.36"), "broken in earlier versions") |
| 18 | 18 |
skip.If(t, testEnv.DaemonInfo.OSType == "windows", "FIXME") |
| 19 | 19 |
defer setupTest(t)() |
| 20 |
- client := request.NewAPIClient(t) |
|
| 20 |
+ client := testEnv.APIClient() |
|
| 21 | 21 |
ctx := context.Background() |
| 22 | 22 |
|
| 23 | 23 |
cID1 := container.Create(t, ctx, client) |
| ... | ... |
@@ -9,7 +9,6 @@ import ( |
| 9 | 9 |
"testing" |
| 10 | 10 |
|
| 11 | 11 |
"github.com/docker/docker/api/types" |
| 12 |
- "github.com/docker/docker/internal/test/request" |
|
| 13 | 12 |
"github.com/docker/docker/internal/testutil" |
| 14 | 13 |
"gotest.tools/skip" |
| 15 | 14 |
) |
| ... | ... |
@@ -19,7 +18,8 @@ func TestImportExtremelyLargeImageWorks(t *testing.T) {
|
| 19 | 19 |
skip.If(t, runtime.GOARCH == "arm64", "effective test will be time out") |
| 20 | 20 |
skip.If(t, testEnv.OSType == "windows", "TODO enable on windows") |
| 21 | 21 |
|
| 22 |
- client := request.NewAPIClient(t) |
|
| 22 |
+ defer setupTest(t)() |
|
| 23 |
+ client := testEnv.APIClient() |
|
| 23 | 24 |
|
| 24 | 25 |
// Construct an empty tar archive with about 8GB of junk padding at the |
| 25 | 26 |
// end. This should not cause any crashes (the padding should be mostly |
| ... | ... |
@@ -6,7 +6,6 @@ import ( |
| 6 | 6 |
|
| 7 | 7 |
"github.com/docker/docker/api/types" |
| 8 | 8 |
"github.com/docker/docker/api/types/filters" |
| 9 |
- "github.com/docker/docker/internal/test/request" |
|
| 10 | 9 |
"gotest.tools/assert" |
| 11 | 10 |
is "gotest.tools/assert/cmp" |
| 12 | 11 |
) |
| ... | ... |
@@ -14,7 +13,7 @@ import ( |
| 14 | 14 |
// Regression : #38171 |
| 15 | 15 |
func TestImagesFilterMultiReference(t *testing.T) {
|
| 16 | 16 |
defer setupTest(t)() |
| 17 |
- client := request.NewAPIClient(t) |
|
| 17 |
+ client := testEnv.APIClient() |
|
| 18 | 18 |
ctx := context.Background() |
| 19 | 19 |
|
| 20 | 20 |
name := "images_filter_multi_reference" |
| ... | ... |
@@ -6,7 +6,6 @@ import ( |
| 6 | 6 |
|
| 7 | 7 |
"github.com/docker/docker/api/types" |
| 8 | 8 |
"github.com/docker/docker/integration/internal/container" |
| 9 |
- "github.com/docker/docker/internal/test/request" |
|
| 10 | 9 |
"gotest.tools/assert" |
| 11 | 10 |
is "gotest.tools/assert/cmp" |
| 12 | 11 |
"gotest.tools/skip" |
| ... | ... |
@@ -16,7 +15,7 @@ func TestRemoveImageOrphaning(t *testing.T) {
|
| 16 | 16 |
skip.If(t, testEnv.DaemonInfo.OSType == "windows", "FIXME") |
| 17 | 17 |
defer setupTest(t)() |
| 18 | 18 |
ctx := context.Background() |
| 19 |
- client := request.NewAPIClient(t) |
|
| 19 |
+ client := testEnv.APIClient() |
|
| 20 | 20 |
|
| 21 | 21 |
img := "test-container-orphaning" |
| 22 | 22 |
|
| ... | ... |
@@ -5,7 +5,6 @@ import ( |
| 5 | 5 |
"fmt" |
| 6 | 6 |
"testing" |
| 7 | 7 |
|
| 8 |
- "github.com/docker/docker/internal/test/request" |
|
| 9 | 8 |
"github.com/docker/docker/internal/testutil" |
| 10 | 9 |
"gotest.tools/assert" |
| 11 | 10 |
is "gotest.tools/assert/cmp" |
| ... | ... |
@@ -15,7 +14,7 @@ import ( |
| 15 | 15 |
// tagging a named image in a new unprefixed repo should work |
| 16 | 16 |
func TestTagUnprefixedRepoByNameOrName(t *testing.T) {
|
| 17 | 17 |
defer setupTest(t)() |
| 18 |
- client := request.NewAPIClient(t) |
|
| 18 |
+ client := testEnv.APIClient() |
|
| 19 | 19 |
ctx := context.Background() |
| 20 | 20 |
|
| 21 | 21 |
// By name |
| ... | ... |
@@ -33,7 +32,7 @@ func TestTagUnprefixedRepoByNameOrName(t *testing.T) {
|
| 33 | 33 |
// TODO (yongtang): Migrate to unit tests |
| 34 | 34 |
func TestTagInvalidReference(t *testing.T) {
|
| 35 | 35 |
defer setupTest(t)() |
| 36 |
- client := request.NewAPIClient(t) |
|
| 36 |
+ client := testEnv.APIClient() |
|
| 37 | 37 |
ctx := context.Background() |
| 38 | 38 |
|
| 39 | 39 |
invalidRepos := []string{"fo$z$", "Foo@3cc", "Foo$3", "Foo*3", "Fo^3", "Foo!3", "F)xcz(", "fo%asd", "FOO/bar"}
|
| ... | ... |
@@ -72,7 +71,7 @@ func TestTagInvalidReference(t *testing.T) {
|
| 72 | 72 |
// ensure we allow the use of valid tags |
| 73 | 73 |
func TestTagValidPrefixedRepo(t *testing.T) {
|
| 74 | 74 |
defer setupTest(t)() |
| 75 |
- client := request.NewAPIClient(t) |
|
| 75 |
+ client := testEnv.APIClient() |
|
| 76 | 76 |
ctx := context.Background() |
| 77 | 77 |
|
| 78 | 78 |
validRepos := []string{"fooo/bar", "fooaa/test", "foooo:t", "HOSTNAME.DOMAIN.COM:443/foo/bar"}
|
| ... | ... |
@@ -86,7 +85,7 @@ func TestTagValidPrefixedRepo(t *testing.T) {
|
| 86 | 86 |
// tag an image with an existed tag name without -f option should work |
| 87 | 87 |
func TestTagExistedNameWithoutForce(t *testing.T) {
|
| 88 | 88 |
defer setupTest(t)() |
| 89 |
- client := request.NewAPIClient(t) |
|
| 89 |
+ client := testEnv.APIClient() |
|
| 90 | 90 |
ctx := context.Background() |
| 91 | 91 |
|
| 92 | 92 |
err := client.ImageTag(ctx, "busybox:latest", "busybox:test") |
| ... | ... |
@@ -98,7 +97,7 @@ func TestTagExistedNameWithoutForce(t *testing.T) {
|
| 98 | 98 |
func TestTagOfficialNames(t *testing.T) {
|
| 99 | 99 |
skip.If(t, testEnv.OSType == "windows") |
| 100 | 100 |
defer setupTest(t)() |
| 101 |
- client := request.NewAPIClient(t) |
|
| 101 |
+ client := testEnv.APIClient() |
|
| 102 | 102 |
ctx := context.Background() |
| 103 | 103 |
|
| 104 | 104 |
names := []string{
|
| ... | ... |
@@ -128,7 +127,7 @@ func TestTagOfficialNames(t *testing.T) {
|
| 128 | 128 |
// ensure tags can not match digests |
| 129 | 129 |
func TestTagMatchesDigest(t *testing.T) {
|
| 130 | 130 |
defer setupTest(t)() |
| 131 |
- client := request.NewAPIClient(t) |
|
| 131 |
+ client := testEnv.APIClient() |
|
| 132 | 132 |
ctx := context.Background() |
| 133 | 133 |
|
| 134 | 134 |
digest := "busybox@sha256:abcdef76720241213f5303bda7704ec4c2ef75613173910a56fb1b6e20251507" |
| ... | ... |
@@ -6,8 +6,8 @@ import ( |
| 6 | 6 |
|
| 7 | 7 |
"github.com/docker/docker/api/types" |
| 8 | 8 |
"github.com/docker/docker/api/types/versions" |
| 9 |
+ dclient "github.com/docker/docker/client" |
|
| 9 | 10 |
"github.com/docker/docker/integration/internal/network" |
| 10 |
- "github.com/docker/docker/internal/test/request" |
|
| 11 | 11 |
"gotest.tools/assert" |
| 12 | 12 |
is "gotest.tools/assert/cmp" |
| 13 | 13 |
"gotest.tools/skip" |
| ... | ... |
@@ -27,10 +27,7 @@ func containsNetwork(nws []types.NetworkResource, networkID string) bool {
|
| 27 | 27 |
// first network's ID as name. |
| 28 | 28 |
// |
| 29 | 29 |
// After successful creation, properties of all three networks is returned |
| 30 |
-func createAmbiguousNetworks(t *testing.T) (string, string, string) {
|
|
| 31 |
- client := request.NewAPIClient(t) |
|
| 32 |
- ctx := context.Background() |
|
| 33 |
- |
|
| 30 |
+func createAmbiguousNetworks(t *testing.T, ctx context.Context, client dclient.APIClient) (string, string, string) { // nolint: golint
|
|
| 34 | 31 |
testNet := network.CreateNoError(t, ctx, client, "testNet") |
| 35 | 32 |
idPrefixNet := network.CreateNoError(t, ctx, client, testNet[:12]) |
| 36 | 33 |
fullIDNet := network.CreateNoError(t, ctx, client, testNet) |
| ... | ... |
@@ -48,7 +45,7 @@ func createAmbiguousNetworks(t *testing.T) (string, string, string) {
|
| 48 | 48 |
func TestNetworkCreateDelete(t *testing.T) {
|
| 49 | 49 |
skip.If(t, testEnv.DaemonInfo.OSType != "linux") |
| 50 | 50 |
defer setupTest(t)() |
| 51 |
- client := request.NewAPIClient(t) |
|
| 51 |
+ client := testEnv.APIClient() |
|
| 52 | 52 |
ctx := context.Background() |
| 53 | 53 |
|
| 54 | 54 |
netName := "testnetwork_" + t.Name() |
| ... | ... |
@@ -71,9 +68,9 @@ func TestDockerNetworkDeletePreferID(t *testing.T) {
|
| 71 | 71 |
skip.If(t, testEnv.OSType == "windows", |
| 72 | 72 |
"FIXME. Windows doesn't run DinD and uses networks shared between control daemon and daemon under test") |
| 73 | 73 |
defer setupTest(t)() |
| 74 |
- client := request.NewAPIClient(t) |
|
| 74 |
+ client := testEnv.APIClient() |
|
| 75 | 75 |
ctx := context.Background() |
| 76 |
- testNet, idPrefixNet, fullIDNet := createAmbiguousNetworks(t) |
|
| 76 |
+ testNet, idPrefixNet, fullIDNet := createAmbiguousNetworks(t, ctx, client) |
|
| 77 | 77 |
|
| 78 | 78 |
// Delete the network using a prefix of the first network's ID as name. |
| 79 | 79 |
// This should the network name with the id-prefix, not the original network. |
| ... | ... |
@@ -28,7 +28,7 @@ func TestEventsExecDie(t *testing.T) {
|
| 28 | 28 |
skip.If(t, testEnv.OSType == "windows", "FIXME. Suspect may need to wait until container is running before exec") |
| 29 | 29 |
defer setupTest(t)() |
| 30 | 30 |
ctx := context.Background() |
| 31 |
- client := request.NewAPIClient(t) |
|
| 31 |
+ client := testEnv.APIClient() |
|
| 32 | 32 |
|
| 33 | 33 |
cID := container.Run(t, ctx, client) |
| 34 | 34 |
|
| ... | ... |
@@ -78,7 +78,7 @@ func TestEventsBackwardsCompatible(t *testing.T) {
|
| 78 | 78 |
skip.If(t, testEnv.OSType == "windows", "Windows doesn't support back-compat messages") |
| 79 | 79 |
defer setupTest(t)() |
| 80 | 80 |
ctx := context.Background() |
| 81 |
- client := request.NewAPIClient(t) |
|
| 81 |
+ client := testEnv.APIClient() |
|
| 82 | 82 |
|
| 83 | 83 |
since := request.DaemonTime(ctx, t, client, testEnv) |
| 84 | 84 |
ts := strconv.FormatInt(since.Unix(), 10) |
| ... | ... |
@@ -7,14 +7,14 @@ import ( |
| 7 | 7 |
"net/http" |
| 8 | 8 |
"testing" |
| 9 | 9 |
|
| 10 |
- "github.com/docker/docker/internal/test/request" |
|
| 11 | 10 |
req "github.com/docker/docker/internal/test/request" |
| 12 | 11 |
"gotest.tools/assert" |
| 13 | 12 |
is "gotest.tools/assert/cmp" |
| 14 | 13 |
) |
| 15 | 14 |
|
| 16 | 15 |
func TestInfoBinaryCommits(t *testing.T) {
|
| 17 |
- client := request.NewAPIClient(t) |
|
| 16 |
+ defer setupTest(t)() |
|
| 17 |
+ client := testEnv.APIClient() |
|
| 18 | 18 |
|
| 19 | 19 |
info, err := client.Info(context.Background()) |
| 20 | 20 |
assert.NilError(t, err) |
| ... | ... |
@@ -6,14 +6,14 @@ import ( |
| 6 | 6 |
"testing" |
| 7 | 7 |
|
| 8 | 8 |
"github.com/docker/docker/internal/test/daemon" |
| 9 |
- "github.com/docker/docker/internal/test/request" |
|
| 10 | 9 |
"gotest.tools/assert" |
| 11 | 10 |
is "gotest.tools/assert/cmp" |
| 12 | 11 |
"gotest.tools/skip" |
| 13 | 12 |
) |
| 14 | 13 |
|
| 15 | 14 |
func TestInfoAPI(t *testing.T) {
|
| 16 |
- client := request.NewAPIClient(t) |
|
| 15 |
+ defer setupTest(t)() |
|
| 16 |
+ client := testEnv.APIClient() |
|
| 17 | 17 |
|
| 18 | 18 |
info, err := client.Info(context.Background()) |
| 19 | 19 |
assert.NilError(t, err) |
| ... | ... |
@@ -6,7 +6,6 @@ import ( |
| 6 | 6 |
|
| 7 | 7 |
"github.com/docker/docker/api/types" |
| 8 | 8 |
"github.com/docker/docker/integration/internal/requirement" |
| 9 |
- "github.com/docker/docker/internal/test/request" |
|
| 10 | 9 |
"gotest.tools/assert" |
| 11 | 10 |
is "gotest.tools/assert/cmp" |
| 12 | 11 |
"gotest.tools/skip" |
| ... | ... |
@@ -16,7 +15,8 @@ import ( |
| 16 | 16 |
func TestLoginFailsWithBadCredentials(t *testing.T) {
|
| 17 | 17 |
skip.If(t, !requirement.HasHubConnectivity(t)) |
| 18 | 18 |
|
| 19 |
- client := request.NewAPIClient(t) |
|
| 19 |
+ defer setupTest(t)() |
|
| 20 |
+ client := testEnv.APIClient() |
|
| 20 | 21 |
|
| 21 | 22 |
config := types.AuthConfig{
|
| 22 | 23 |
Username: "no-user", |
| ... | ... |
@@ -4,13 +4,13 @@ import ( |
| 4 | 4 |
"context" |
| 5 | 5 |
"testing" |
| 6 | 6 |
|
| 7 |
- "github.com/docker/docker/internal/test/request" |
|
| 8 | 7 |
"gotest.tools/assert" |
| 9 | 8 |
is "gotest.tools/assert/cmp" |
| 10 | 9 |
) |
| 11 | 10 |
|
| 12 | 11 |
func TestVersion(t *testing.T) {
|
| 13 |
- client := request.NewAPIClient(t) |
|
| 12 |
+ defer setupTest(t)() |
|
| 13 |
+ client := testEnv.APIClient() |
|
| 14 | 14 |
|
| 15 | 15 |
version, err := client.ServerVersion(context.Background()) |
| 16 | 16 |
assert.NilError(t, err) |
| ... | ... |
@@ -22,7 +22,7 @@ import ( |
| 22 | 22 |
func TestVolumesCreateAndList(t *testing.T) {
|
| 23 | 23 |
skip.If(t, testEnv.IsRemoteDaemon, "cannot run daemon when remote daemon") |
| 24 | 24 |
defer setupTest(t)() |
| 25 |
- client := request.NewAPIClient(t) |
|
| 25 |
+ client := testEnv.APIClient() |
|
| 26 | 26 |
ctx := context.Background() |
| 27 | 27 |
|
| 28 | 28 |
name := t.Name() |
| ... | ... |
@@ -52,7 +52,7 @@ func TestVolumesCreateAndList(t *testing.T) {
|
| 52 | 52 |
func TestVolumesRemove(t *testing.T) {
|
| 53 | 53 |
skip.If(t, testEnv.OSType == "windows", "FIXME") |
| 54 | 54 |
defer setupTest(t)() |
| 55 |
- client := request.NewAPIClient(t) |
|
| 55 |
+ client := testEnv.APIClient() |
|
| 56 | 56 |
ctx := context.Background() |
| 57 | 57 |
|
| 58 | 58 |
prefix, slash := getPrefixAndSlashFromDaemonPlatform() |
| ... | ... |
@@ -78,7 +78,7 @@ func TestVolumesRemove(t *testing.T) {
|
| 78 | 78 |
func TestVolumesInspect(t *testing.T) {
|
| 79 | 79 |
skip.If(t, testEnv.IsRemoteDaemon, "cannot run daemon when remote daemon") |
| 80 | 80 |
defer setupTest(t)() |
| 81 |
- client := request.NewAPIClient(t) |
|
| 81 |
+ client := testEnv.APIClient() |
|
| 82 | 82 |
ctx := context.Background() |
| 83 | 83 |
|
| 84 | 84 |
now := time.Now() |