Browse code

integration/container: use consistent name for api-client

The `client` variable was colliding with the `client` import in various
files. While it didn't conflict in all files, there was inconsistency
in the naming, sometimes using the confusing `cli` name (it's not the
"cli"), and such names can easily start spreading (through copy/paste,
or "code by example").

Let's make a one-time pass through all of them in this package to use
the same name.

Signed-off-by: Sebastiaan van Stijn <github@gone.nl>

Sebastiaan van Stijn authored on 2023/08/11 20:45:45
Showing 35 changed files
... ...
@@ -13,7 +13,7 @@ import (
13 13
 
14 14
 func TestAttach(t *testing.T) {
15 15
 	t.Cleanup(setupTest(t))
16
-	client := testEnv.APIClient()
16
+	apiClient := testEnv.APIClient()
17 17
 
18 18
 	tests := []struct {
19 19
 		doc               string
... ...
@@ -34,7 +34,7 @@ func TestAttach(t *testing.T) {
34 34
 		tc := tc
35 35
 		t.Run(tc.doc, func(t *testing.T) {
36 36
 			t.Parallel()
37
-			resp, err := client.ContainerCreate(context.Background(),
37
+			resp, err := apiClient.ContainerCreate(context.Background(),
38 38
 				&container.Config{
39 39
 					Image: "busybox",
40 40
 					Cmd:   []string{"echo", "hello"},
... ...
@@ -46,7 +46,7 @@ func TestAttach(t *testing.T) {
46 46
 				"",
47 47
 			)
48 48
 			assert.NilError(t, err)
49
-			attach, err := client.ContainerAttach(context.Background(), resp.ID, types.ContainerAttachOptions{
49
+			attach, err := apiClient.ContainerAttach(context.Background(), resp.ID, types.ContainerAttachOptions{
50 50
 				Stdout: true,
51 51
 				Stderr: true,
52 52
 			})
... ...
@@ -30,16 +30,16 @@ func TestCreateWithCDIDevices(t *testing.T) {
30 30
 	d.StartWithBusybox(t, "--cdi-spec-dir="+filepath.Join(cwd, "testdata", "cdi"))
31 31
 	defer d.Stop(t)
32 32
 
33
-	client := d.NewClientT(t)
33
+	apiClient := d.NewClientT(t)
34 34
 
35 35
 	ctx := context.Background()
36
-	id := container.Run(ctx, t, client,
36
+	id := container.Run(ctx, t, apiClient,
37 37
 		container.WithCmd("/bin/sh", "-c", "env"),
38 38
 		container.WithCDIDevices("vendor1.com/device=foo"),
39 39
 	)
40
-	defer client.ContainerRemove(ctx, id, types.ContainerRemoveOptions{Force: true})
40
+	defer apiClient.ContainerRemove(ctx, id, types.ContainerRemoveOptions{Force: true})
41 41
 
42
-	inspect, err := client.ContainerInspect(ctx, id)
42
+	inspect, err := apiClient.ContainerInspect(ctx, id)
43 43
 	assert.NilError(t, err)
44 44
 
45 45
 	expectedRequests := []containertypes.DeviceRequest{
... ...
@@ -50,7 +50,7 @@ func TestCreateWithCDIDevices(t *testing.T) {
50 50
 	}
51 51
 	assert.Check(t, is.DeepEqual(inspect.HostConfig.DeviceRequests, expectedRequests))
52 52
 
53
-	reader, err := client.ContainerLogs(ctx, id, types.ContainerLogsOptions{
53
+	reader, err := apiClient.ContainerLogs(ctx, id, types.ContainerLogsOptions{
54 54
 		ShowStdout: true,
55 55
 	})
56 56
 	assert.NilError(t, err)
... ...
@@ -42,7 +42,7 @@ func TestCheckpoint(t *testing.T) {
42 42
 	assert.NilError(t, err)
43 43
 
44 44
 	ctx := context.Background()
45
-	client := request.NewAPIClient(t)
45
+	apiClient := request.NewAPIClient(t)
46 46
 
47 47
 	mnt := mounttypes.Mount{
48 48
 		Type:   mounttypes.TypeTmpfs,
... ...
@@ -50,9 +50,9 @@ func TestCheckpoint(t *testing.T) {
50 50
 	}
51 51
 
52 52
 	t.Log("Start a container")
53
-	cID := container.Run(ctx, t, client, container.WithMount(mnt))
53
+	cID := container.Run(ctx, t, apiClient, container.WithMount(mnt))
54 54
 	poll.WaitOn(t,
55
-		container.IsInState(ctx, client, cID, "running"),
55
+		container.IsInState(ctx, apiClient, cID, "running"),
56 56
 		poll.WithDelay(100*time.Millisecond),
57 57
 	)
58 58
 
... ...
@@ -80,7 +80,7 @@ func TestCheckpoint(t *testing.T) {
80 80
 		}()
81 81
 	}
82 82
 	t.Log("Do a checkpoint and leave the container running")
83
-	err = client.CheckpointCreate(ctx, cID, cptOpt)
83
+	err = apiClient.CheckpointCreate(ctx, cID, cptOpt)
84 84
 	if err != nil {
85 85
 		// An error can contain a path to a dump file
86 86
 		t.Log(err)
... ...
@@ -96,17 +96,17 @@ func TestCheckpoint(t *testing.T) {
96 96
 	}
97 97
 	assert.NilError(t, err)
98 98
 
99
-	inspect, err := client.ContainerInspect(ctx, cID)
99
+	inspect, err := apiClient.ContainerInspect(ctx, cID)
100 100
 	assert.NilError(t, err)
101 101
 	assert.Check(t, is.Equal(true, inspect.State.Running))
102 102
 
103
-	checkpoints, err := client.CheckpointList(ctx, cID, types.CheckpointListOptions{})
103
+	checkpoints, err := apiClient.CheckpointList(ctx, cID, types.CheckpointListOptions{})
104 104
 	assert.NilError(t, err)
105 105
 	assert.Equal(t, len(checkpoints), 1)
106 106
 	assert.Equal(t, checkpoints[0].Name, "test")
107 107
 
108 108
 	// Create a test file on a tmpfs mount.
109
-	containerExec(t, client, cID, []string{"touch", "/tmp/test-file"})
109
+	containerExec(t, apiClient, cID, []string{"touch", "/tmp/test-file"})
110 110
 
111 111
 	// Do a second checkpoint
112 112
 	cptOpt = types.CheckpointCreateOptions{
... ...
@@ -114,20 +114,20 @@ func TestCheckpoint(t *testing.T) {
114 114
 		CheckpointID: "test2",
115 115
 	}
116 116
 	t.Log("Do a checkpoint and stop the container")
117
-	err = client.CheckpointCreate(ctx, cID, cptOpt)
117
+	err = apiClient.CheckpointCreate(ctx, cID, cptOpt)
118 118
 	assert.NilError(t, err)
119 119
 
120 120
 	poll.WaitOn(t,
121
-		container.IsInState(ctx, client, cID, "exited"),
121
+		container.IsInState(ctx, apiClient, cID, "exited"),
122 122
 		poll.WithDelay(100*time.Millisecond),
123 123
 	)
124 124
 
125
-	inspect, err = client.ContainerInspect(ctx, cID)
125
+	inspect, err = apiClient.ContainerInspect(ctx, cID)
126 126
 	assert.NilError(t, err)
127 127
 	assert.Check(t, is.Equal(false, inspect.State.Running))
128 128
 
129 129
 	// Check that both checkpoints are listed.
130
-	checkpoints, err = client.CheckpointList(ctx, cID, types.CheckpointListOptions{})
130
+	checkpoints, err = apiClient.CheckpointList(ctx, cID, types.CheckpointListOptions{})
131 131
 	assert.NilError(t, err)
132 132
 	assert.Equal(t, len(checkpoints), 2)
133 133
 	cptNames := make([]string, 2)
... ...
@@ -143,22 +143,22 @@ func TestCheckpoint(t *testing.T) {
143 143
 		CheckpointID: "test2",
144 144
 	}
145 145
 	t.Log("Restore the container")
146
-	err = client.ContainerStart(ctx, cID, startOpt)
146
+	err = apiClient.ContainerStart(ctx, cID, startOpt)
147 147
 	assert.NilError(t, err)
148 148
 
149
-	inspect, err = client.ContainerInspect(ctx, cID)
149
+	inspect, err = apiClient.ContainerInspect(ctx, cID)
150 150
 	assert.NilError(t, err)
151 151
 	assert.Check(t, is.Equal(true, inspect.State.Running))
152 152
 
153 153
 	// Check that the test file has been restored.
154
-	containerExec(t, client, cID, []string{"test", "-f", "/tmp/test-file"})
154
+	containerExec(t, apiClient, cID, []string{"test", "-f", "/tmp/test-file"})
155 155
 
156 156
 	for _, id := range []string{"test", "test2"} {
157 157
 		cptDelOpt := types.CheckpointDeleteOptions{
158 158
 			CheckpointID: id,
159 159
 		}
160 160
 
161
-		err = client.CheckpointDelete(ctx, cID, cptDelOpt)
161
+		err = apiClient.CheckpointDelete(ctx, cID, cptDelOpt)
162 162
 		assert.NilError(t, err)
163 163
 	}
164 164
 }
... ...
@@ -25,10 +25,10 @@ func TestCopyFromContainerPathDoesNotExist(t *testing.T) {
25 25
 	defer setupTest(t)()
26 26
 
27 27
 	ctx := context.Background()
28
-	apiclient := testEnv.APIClient()
29
-	cid := container.Create(ctx, t, apiclient)
28
+	apiClient := testEnv.APIClient()
29
+	cid := container.Create(ctx, t, apiClient)
30 30
 
31
-	_, _, err := apiclient.CopyFromContainer(ctx, cid, "/dne")
31
+	_, _, err := apiClient.CopyFromContainer(ctx, cid, "/dne")
32 32
 	assert.Check(t, is.ErrorType(err, errdefs.IsNotFound))
33 33
 	assert.Check(t, is.ErrorContains(err, "Could not find the file /dne in container "+cid))
34 34
 }
... ...
@@ -37,8 +37,8 @@ func TestCopyFromContainerPathIsNotDir(t *testing.T) {
37 37
 	defer setupTest(t)()
38 38
 
39 39
 	ctx := context.Background()
40
-	apiclient := testEnv.APIClient()
41
-	cid := container.Create(ctx, t, apiclient)
40
+	apiClient := testEnv.APIClient()
41
+	cid := container.Create(ctx, t, apiClient)
42 42
 
43 43
 	path := "/etc/passwd/"
44 44
 	expected := "not a directory"
... ...
@@ -46,7 +46,7 @@ func TestCopyFromContainerPathIsNotDir(t *testing.T) {
46 46
 		path = "c:/windows/system32/drivers/etc/hosts/"
47 47
 		expected = "The filename, directory name, or volume label syntax is incorrect."
48 48
 	}
49
-	_, _, err := apiclient.CopyFromContainer(ctx, cid, path)
49
+	_, _, err := apiClient.CopyFromContainer(ctx, cid, path)
50 50
 	assert.Assert(t, is.ErrorContains(err, expected))
51 51
 }
52 52
 
... ...
@@ -54,10 +54,10 @@ func TestCopyToContainerPathDoesNotExist(t *testing.T) {
54 54
 	defer setupTest(t)()
55 55
 
56 56
 	ctx := context.Background()
57
-	apiclient := testEnv.APIClient()
58
-	cid := container.Create(ctx, t, apiclient)
57
+	apiClient := testEnv.APIClient()
58
+	cid := container.Create(ctx, t, apiClient)
59 59
 
60
-	err := apiclient.CopyToContainer(ctx, cid, "/dne", nil, types.CopyToContainerOptions{})
60
+	err := apiClient.CopyToContainer(ctx, cid, "/dne", nil, types.CopyToContainerOptions{})
61 61
 	assert.Check(t, is.ErrorType(err, errdefs.IsNotFound))
62 62
 	assert.Check(t, is.ErrorContains(err, "Could not find the file /dne in container "+cid))
63 63
 }
... ...
@@ -66,28 +66,28 @@ func TestCopyEmptyFile(t *testing.T) {
66 66
 	defer setupTest(t)()
67 67
 
68 68
 	ctx := context.Background()
69
-	apiclient := testEnv.APIClient()
70
-	cid := container.Create(ctx, t, apiclient)
69
+	apiClient := testEnv.APIClient()
70
+	cid := container.Create(ctx, t, apiClient)
71 71
 
72 72
 	// empty content
73 73
 	dstDir, _ := makeEmptyArchive(t)
74
-	err := apiclient.CopyToContainer(ctx, cid, dstDir, bytes.NewReader([]byte("")), types.CopyToContainerOptions{})
74
+	err := apiClient.CopyToContainer(ctx, cid, dstDir, bytes.NewReader([]byte("")), types.CopyToContainerOptions{})
75 75
 	assert.NilError(t, err)
76 76
 
77 77
 	// tar with empty file
78 78
 	dstDir, preparedArchive := makeEmptyArchive(t)
79
-	err = apiclient.CopyToContainer(ctx, cid, dstDir, preparedArchive, types.CopyToContainerOptions{})
79
+	err = apiClient.CopyToContainer(ctx, cid, dstDir, preparedArchive, types.CopyToContainerOptions{})
80 80
 	assert.NilError(t, err)
81 81
 
82 82
 	// tar with empty file archive mode
83 83
 	dstDir, preparedArchive = makeEmptyArchive(t)
84
-	err = apiclient.CopyToContainer(ctx, cid, dstDir, preparedArchive, types.CopyToContainerOptions{
84
+	err = apiClient.CopyToContainer(ctx, cid, dstDir, preparedArchive, types.CopyToContainerOptions{
85 85
 		CopyUIDGID: true,
86 86
 	})
87 87
 	assert.NilError(t, err)
88 88
 
89 89
 	// copy from empty file
90
-	rdr, _, err := apiclient.CopyFromContainer(ctx, cid, dstDir)
90
+	rdr, _, err := apiClient.CopyFromContainer(ctx, cid, dstDir)
91 91
 	assert.NilError(t, err)
92 92
 	defer rdr.Close()
93 93
 }
... ...
@@ -123,14 +123,14 @@ func TestCopyToContainerPathIsNotDir(t *testing.T) {
123 123
 	defer setupTest(t)()
124 124
 
125 125
 	ctx := context.Background()
126
-	apiclient := testEnv.APIClient()
127
-	cid := container.Create(ctx, t, apiclient)
126
+	apiClient := testEnv.APIClient()
127
+	cid := container.Create(ctx, t, apiClient)
128 128
 
129 129
 	path := "/etc/passwd/"
130 130
 	if testEnv.DaemonInfo.OSType == "windows" {
131 131
 		path = "c:/windows/system32/drivers/etc/hosts/"
132 132
 	}
133
-	err := apiclient.CopyToContainer(ctx, cid, path, nil, types.CopyToContainerOptions{})
133
+	err := apiClient.CopyToContainer(ctx, cid, path, nil, types.CopyToContainerOptions{})
134 134
 	assert.Check(t, is.ErrorContains(err, "not a directory"))
135 135
 }
136 136
 
... ...
@@ -25,7 +25,7 @@ import (
25 25
 
26 26
 func TestCreateFailsWhenIdentifierDoesNotExist(t *testing.T) {
27 27
 	t.Cleanup(setupTest(t))
28
-	client := testEnv.APIClient()
28
+	apiClient := testEnv.APIClient()
29 29
 
30 30
 	testCases := []struct {
31 31
 		doc           string
... ...
@@ -53,7 +53,7 @@ func TestCreateFailsWhenIdentifierDoesNotExist(t *testing.T) {
53 53
 		tc := tc
54 54
 		t.Run(tc.doc, func(t *testing.T) {
55 55
 			t.Parallel()
56
-			_, err := client.ContainerCreate(context.Background(),
56
+			_, err := apiClient.ContainerCreate(context.Background(),
57 57
 				&container.Config{Image: tc.image},
58 58
 				&container.HostConfig{},
59 59
 				&network.NetworkingConfig{},
... ...
@@ -72,9 +72,9 @@ func TestCreateFailsWhenIdentifierDoesNotExist(t *testing.T) {
72 72
 func TestCreateLinkToNonExistingContainer(t *testing.T) {
73 73
 	skip.If(t, testEnv.DaemonInfo.OSType == "windows", "legacy links are not supported on windows")
74 74
 	defer setupTest(t)()
75
-	c := testEnv.APIClient()
75
+	apiClient := testEnv.APIClient()
76 76
 
77
-	_, err := c.ContainerCreate(context.Background(),
77
+	_, err := apiClient.ContainerCreate(context.Background(),
78 78
 		&container.Config{
79 79
 			Image: "busybox",
80 80
 		},
... ...
@@ -91,7 +91,7 @@ func TestCreateLinkToNonExistingContainer(t *testing.T) {
91 91
 
92 92
 func TestCreateWithInvalidEnv(t *testing.T) {
93 93
 	t.Cleanup(setupTest(t))
94
-	client := testEnv.APIClient()
94
+	apiClient := testEnv.APIClient()
95 95
 
96 96
 	testCases := []struct {
97 97
 		env           string
... ...
@@ -115,7 +115,7 @@ func TestCreateWithInvalidEnv(t *testing.T) {
115 115
 		tc := tc
116 116
 		t.Run(strconv.Itoa(index), func(t *testing.T) {
117 117
 			t.Parallel()
118
-			_, err := client.ContainerCreate(context.Background(),
118
+			_, err := apiClient.ContainerCreate(context.Background(),
119 119
 				&container.Config{
120 120
 					Image: "busybox",
121 121
 					Env:   []string{tc.env},
... ...
@@ -136,7 +136,7 @@ func TestCreateTmpfsMountsTarget(t *testing.T) {
136 136
 	skip.If(t, testEnv.DaemonInfo.OSType == "windows")
137 137
 
138 138
 	defer setupTest(t)()
139
-	client := testEnv.APIClient()
139
+	apiClient := testEnv.APIClient()
140 140
 
141 141
 	testCases := []struct {
142 142
 		target        string
... ...
@@ -161,7 +161,7 @@ func TestCreateTmpfsMountsTarget(t *testing.T) {
161 161
 	}
162 162
 
163 163
 	for _, tc := range testCases {
164
-		_, err := client.ContainerCreate(context.Background(),
164
+		_, err := apiClient.ContainerCreate(context.Background(),
165 165
 			&container.Config{
166 166
 				Image: "busybox",
167 167
 			},
... ...
@@ -181,7 +181,7 @@ func TestCreateWithCustomMaskedPaths(t *testing.T) {
181 181
 	skip.If(t, testEnv.DaemonInfo.OSType != "linux")
182 182
 
183 183
 	defer setupTest(t)()
184
-	client := testEnv.APIClient()
184
+	apiClient := testEnv.APIClient()
185 185
 	ctx := context.Background()
186 186
 
187 187
 	testCases := []struct {
... ...
@@ -203,7 +203,7 @@ func TestCreateWithCustomMaskedPaths(t *testing.T) {
203 203
 	}
204 204
 
205 205
 	checkInspect := func(t *testing.T, ctx context.Context, name string, expected []string) {
206
-		_, b, err := client.ContainerInspectWithRaw(ctx, name, false)
206
+		_, b, err := apiClient.ContainerInspectWithRaw(ctx, name, false)
207 207
 		assert.NilError(t, err)
208 208
 
209 209
 		var inspectJSON map[string]interface{}
... ...
@@ -236,7 +236,7 @@ func TestCreateWithCustomMaskedPaths(t *testing.T) {
236 236
 		}
237 237
 
238 238
 		// Create the container.
239
-		c, err := client.ContainerCreate(context.Background(),
239
+		c, err := apiClient.ContainerCreate(context.Background(),
240 240
 			&config,
241 241
 			&hc,
242 242
 			&network.NetworkingConfig{},
... ...
@@ -248,10 +248,10 @@ func TestCreateWithCustomMaskedPaths(t *testing.T) {
248 248
 		checkInspect(t, ctx, name, tc.expected)
249 249
 
250 250
 		// Start the container.
251
-		err = client.ContainerStart(ctx, c.ID, types.ContainerStartOptions{})
251
+		err = apiClient.ContainerStart(ctx, c.ID, types.ContainerStartOptions{})
252 252
 		assert.NilError(t, err)
253 253
 
254
-		poll.WaitOn(t, ctr.IsInState(ctx, client, c.ID, "exited"), poll.WithDelay(100*time.Millisecond))
254
+		poll.WaitOn(t, ctr.IsInState(ctx, apiClient, c.ID, "exited"), poll.WithDelay(100*time.Millisecond))
255 255
 
256 256
 		checkInspect(t, ctx, name, tc.expected)
257 257
 	}
... ...
@@ -261,7 +261,7 @@ func TestCreateWithCustomReadonlyPaths(t *testing.T) {
261 261
 	skip.If(t, testEnv.DaemonInfo.OSType != "linux")
262 262
 
263 263
 	defer setupTest(t)()
264
-	client := testEnv.APIClient()
264
+	apiClient := testEnv.APIClient()
265 265
 	ctx := context.Background()
266 266
 
267 267
 	testCases := []struct {
... ...
@@ -283,7 +283,7 @@ func TestCreateWithCustomReadonlyPaths(t *testing.T) {
283 283
 	}
284 284
 
285 285
 	checkInspect := func(t *testing.T, ctx context.Context, name string, expected []string) {
286
-		_, b, err := client.ContainerInspectWithRaw(ctx, name, false)
286
+		_, b, err := apiClient.ContainerInspectWithRaw(ctx, name, false)
287 287
 		assert.NilError(t, err)
288 288
 
289 289
 		var inspectJSON map[string]interface{}
... ...
@@ -315,7 +315,7 @@ func TestCreateWithCustomReadonlyPaths(t *testing.T) {
315 315
 		}
316 316
 
317 317
 		// Create the container.
318
-		c, err := client.ContainerCreate(context.Background(),
318
+		c, err := apiClient.ContainerCreate(context.Background(),
319 319
 			&config,
320 320
 			&hc,
321 321
 			&network.NetworkingConfig{},
... ...
@@ -327,10 +327,10 @@ func TestCreateWithCustomReadonlyPaths(t *testing.T) {
327 327
 		checkInspect(t, ctx, name, tc.expected)
328 328
 
329 329
 		// Start the container.
330
-		err = client.ContainerStart(ctx, c.ID, types.ContainerStartOptions{})
330
+		err = apiClient.ContainerStart(ctx, c.ID, types.ContainerStartOptions{})
331 331
 		assert.NilError(t, err)
332 332
 
333
-		poll.WaitOn(t, ctr.IsInState(ctx, client, c.ID, "exited"), poll.WithDelay(100*time.Millisecond))
333
+		poll.WaitOn(t, ctr.IsInState(ctx, apiClient, c.ID, "exited"), poll.WithDelay(100*time.Millisecond))
334 334
 
335 335
 		checkInspect(t, ctx, name, tc.expected)
336 336
 	}
... ...
@@ -338,7 +338,7 @@ func TestCreateWithCustomReadonlyPaths(t *testing.T) {
338 338
 
339 339
 func TestCreateWithInvalidHealthcheckParams(t *testing.T) {
340 340
 	t.Cleanup(setupTest(t))
341
-	client := testEnv.APIClient()
341
+	apiClient := testEnv.APIClient()
342 342
 	ctx := context.Background()
343 343
 
344 344
 	testCases := []struct {
... ...
@@ -403,7 +403,7 @@ func TestCreateWithInvalidHealthcheckParams(t *testing.T) {
403 403
 				cfg.Healthcheck.StartPeriod = tc.startPeriod
404 404
 			}
405 405
 
406
-			resp, err := client.ContainerCreate(ctx, &cfg, &container.HostConfig{}, nil, nil, "")
406
+			resp, err := apiClient.ContainerCreate(ctx, &cfg, &container.HostConfig{}, nil, nil, "")
407 407
 			assert.Check(t, is.Equal(len(resp.Warnings), 0))
408 408
 
409 409
 			if versions.LessThan(testEnv.DaemonAPIVersion(), "1.32") {
... ...
@@ -421,10 +421,10 @@ func TestCreateWithInvalidHealthcheckParams(t *testing.T) {
421 421
 func TestCreateTmpfsOverrideAnonymousVolume(t *testing.T) {
422 422
 	skip.If(t, testEnv.DaemonInfo.OSType == "windows", "windows does not support tmpfs")
423 423
 	defer setupTest(t)()
424
-	client := testEnv.APIClient()
424
+	apiClient := testEnv.APIClient()
425 425
 	ctx := context.Background()
426 426
 
427
-	id := ctr.Create(ctx, t, client,
427
+	id := ctr.Create(ctx, t, apiClient,
428 428
 		ctr.WithVolume("/foo"),
429 429
 		ctr.WithTmpfs("/foo"),
430 430
 		ctr.WithVolume("/bar"),
... ...
@@ -433,18 +433,18 @@ func TestCreateTmpfsOverrideAnonymousVolume(t *testing.T) {
433 433
 	)
434 434
 
435 435
 	defer func() {
436
-		err := client.ContainerRemove(ctx, id, types.ContainerRemoveOptions{Force: true})
436
+		err := apiClient.ContainerRemove(ctx, id, types.ContainerRemoveOptions{Force: true})
437 437
 		assert.NilError(t, err)
438 438
 	}()
439 439
 
440
-	inspect, err := client.ContainerInspect(ctx, id)
440
+	inspect, err := apiClient.ContainerInspect(ctx, id)
441 441
 	assert.NilError(t, err)
442 442
 	// tmpfs do not currently get added to inspect.Mounts
443 443
 	// Normally an anonymous volume would, except now tmpfs should prevent that.
444 444
 	assert.Assert(t, is.Len(inspect.Mounts, 0))
445 445
 
446
-	chWait, chErr := client.ContainerWait(ctx, id, container.WaitConditionNextExit)
447
-	assert.NilError(t, client.ContainerStart(ctx, id, types.ContainerStartOptions{}))
446
+	chWait, chErr := apiClient.ContainerWait(ctx, id, container.WaitConditionNextExit)
447
+	assert.NilError(t, apiClient.ContainerStart(ctx, id, types.ContainerStartOptions{}))
448 448
 
449 449
 	timeout := time.NewTimer(30 * time.Second)
450 450
 	defer timeout.Stop()
... ...
@@ -467,10 +467,10 @@ func TestCreateTmpfsOverrideAnonymousVolume(t *testing.T) {
467 467
 // error.
468 468
 func TestCreateDifferentPlatform(t *testing.T) {
469 469
 	defer setupTest(t)()
470
-	c := testEnv.APIClient()
470
+	apiClient := testEnv.APIClient()
471 471
 	ctx := context.Background()
472 472
 
473
-	img, _, err := c.ImageInspectWithRaw(ctx, "busybox:latest")
473
+	img, _, err := apiClient.ImageInspectWithRaw(ctx, "busybox:latest")
474 474
 	assert.NilError(t, err)
475 475
 	assert.Assert(t, img.Architecture != "")
476 476
 
... ...
@@ -480,7 +480,7 @@ func TestCreateDifferentPlatform(t *testing.T) {
480 480
 			Architecture: img.Architecture,
481 481
 			Variant:      img.Variant,
482 482
 		}
483
-		_, err := c.ContainerCreate(ctx, &containertypes.Config{Image: "busybox:latest"}, &containertypes.HostConfig{}, nil, &p, "")
483
+		_, err := apiClient.ContainerCreate(ctx, &containertypes.Config{Image: "busybox:latest"}, &containertypes.HostConfig{}, nil, &p, "")
484 484
 		assert.Check(t, is.ErrorType(err, errdefs.IsNotFound))
485 485
 	})
486 486
 	t.Run("different cpu arch", func(t *testing.T) {
... ...
@@ -489,16 +489,16 @@ func TestCreateDifferentPlatform(t *testing.T) {
489 489
 			Architecture: img.Architecture + "DifferentArch",
490 490
 			Variant:      img.Variant,
491 491
 		}
492
-		_, err := c.ContainerCreate(ctx, &containertypes.Config{Image: "busybox:latest"}, &containertypes.HostConfig{}, nil, &p, "")
492
+		_, err := apiClient.ContainerCreate(ctx, &containertypes.Config{Image: "busybox:latest"}, &containertypes.HostConfig{}, nil, &p, "")
493 493
 		assert.Check(t, is.ErrorType(err, errdefs.IsNotFound))
494 494
 	})
495 495
 }
496 496
 
497 497
 func TestCreateVolumesFromNonExistingContainer(t *testing.T) {
498 498
 	defer setupTest(t)()
499
-	cli := testEnv.APIClient()
499
+	apiClient := testEnv.APIClient()
500 500
 
501
-	_, err := cli.ContainerCreate(
501
+	_, err := apiClient.ContainerCreate(
502 502
 		context.Background(),
503 503
 		&container.Config{Image: "busybox"},
504 504
 		&container.HostConfig{VolumesFrom: []string{"nosuchcontainer"}},
... ...
@@ -516,9 +516,9 @@ func TestCreatePlatformSpecificImageNoPlatform(t *testing.T) {
516 516
 
517 517
 	skip.If(t, testEnv.DaemonInfo.Architecture == "arm", "test only makes sense to run on non-arm systems")
518 518
 	skip.If(t, testEnv.DaemonInfo.OSType != "linux", "test image is only available on linux")
519
-	cli := testEnv.APIClient()
519
+	apiClient := testEnv.APIClient()
520 520
 
521
-	_, err := cli.ContainerCreate(
521
+	_, err := apiClient.ContainerCreate(
522 522
 		context.Background(),
523 523
 		&container.Config{Image: "arm32v7/hello-world"},
524 524
 		&container.HostConfig{},
... ...
@@ -194,12 +194,12 @@ func TestRestartDaemonWithRestartingContainer(t *testing.T) {
194 194
 	defer d.Stop(t)
195 195
 
196 196
 	ctx := context.Background()
197
-	client := d.NewClientT(t)
197
+	apiClient := d.NewClientT(t)
198 198
 
199 199
 	// Just create the container, no need to start it to be started.
200 200
 	// We really want to make sure there is no process running when docker starts back up.
201 201
 	// We will manipulate the on disk state later
202
-	id := container.Create(ctx, t, client, container.WithRestartPolicy("always"), container.WithCmd("/bin/sh", "-c", "exit 1"))
202
+	id := container.Create(ctx, t, apiClient, container.WithRestartPolicy("always"), container.WithCmd("/bin/sh", "-c", "exit 1"))
203 203
 
204 204
 	d.Stop(t)
205 205
 
... ...
@@ -212,7 +212,7 @@ func TestRestartDaemonWithRestartingContainer(t *testing.T) {
212 212
 
213 213
 	ctxTimeout, cancel := context.WithTimeout(ctx, 30*time.Second)
214 214
 	defer cancel()
215
-	chOk, chErr := client.ContainerWait(ctxTimeout, id, containerapi.WaitConditionNextExit)
215
+	chOk, chErr := apiClient.ContainerWait(ctxTimeout, id, containerapi.WaitConditionNextExit)
216 216
 	select {
217 217
 	case <-chOk:
218 218
 	case err := <-chErr:
... ...
@@ -239,17 +239,17 @@ func TestHardRestartWhenContainerIsRunning(t *testing.T) {
239 239
 	defer d.Stop(t)
240 240
 
241 241
 	ctx := context.Background()
242
-	client := d.NewClientT(t)
242
+	apiClient := d.NewClientT(t)
243 243
 
244 244
 	// Just create the containers, no need to start them.
245 245
 	// We really want to make sure there is no process running when docker starts back up.
246 246
 	// We will manipulate the on disk state later.
247
-	nopolicy := container.Create(ctx, t, client, container.WithCmd("/bin/sh", "-c", "exit 1"))
248
-	onfailure := container.Create(ctx, t, client, container.WithRestartPolicy("on-failure"), container.WithCmd("/bin/sh", "-c", "sleep 60"))
247
+	noPolicy := container.Create(ctx, t, apiClient, container.WithCmd("/bin/sh", "-c", "exit 1"))
248
+	onFailure := container.Create(ctx, t, apiClient, container.WithRestartPolicy("on-failure"), container.WithCmd("/bin/sh", "-c", "sleep 60"))
249 249
 
250 250
 	d.Stop(t)
251 251
 
252
-	for _, id := range []string{nopolicy, onfailure} {
252
+	for _, id := range []string{noPolicy, onFailure} {
253 253
 		d.TamperWithContainerConfig(t, id, func(c *realcontainer.Container) {
254 254
 			c.SetRunning(nil, nil, true)
255 255
 			c.HasBeenStartedBefore = true
... ...
@@ -261,7 +261,7 @@ func TestHardRestartWhenContainerIsRunning(t *testing.T) {
261 261
 	t.Run("RestartPolicy=none", func(t *testing.T) {
262 262
 		ctx, cancel := context.WithTimeout(ctx, 5*time.Second)
263 263
 		defer cancel()
264
-		inspect, err := client.ContainerInspect(ctx, nopolicy)
264
+		inspect, err := apiClient.ContainerInspect(ctx, noPolicy)
265 265
 		assert.NilError(t, err)
266 266
 		assert.Check(t, is.Equal(inspect.State.Status, "exited"))
267 267
 		assert.Check(t, is.Equal(inspect.State.ExitCode, 255))
... ...
@@ -274,7 +274,7 @@ func TestHardRestartWhenContainerIsRunning(t *testing.T) {
274 274
 	t.Run("RestartPolicy=on-failure", func(t *testing.T) {
275 275
 		ctx, cancel := context.WithTimeout(ctx, 5*time.Second)
276 276
 		defer cancel()
277
-		inspect, err := client.ContainerInspect(ctx, onfailure)
277
+		inspect, err := apiClient.ContainerInspect(ctx, onFailure)
278 278
 		assert.NilError(t, err)
279 279
 		assert.Check(t, is.Equal(inspect.State.Status, "running"))
280 280
 		assert.Check(t, is.Equal(inspect.State.ExitCode, 0))
... ...
@@ -284,6 +284,6 @@ func TestHardRestartWhenContainerIsRunning(t *testing.T) {
284 284
 		}
285 285
 
286 286
 		stopTimeout := 0
287
-		assert.Assert(t, client.ContainerStop(ctx, onfailure, containerapi.StopOptions{Timeout: &stopTimeout}))
287
+		assert.Assert(t, apiClient.ContainerStop(ctx, onFailure, containerapi.StopOptions{Timeout: &stopTimeout}))
288 288
 	})
289 289
 }
... ...
@@ -27,25 +27,25 @@ func TestContainerKillOnDaemonStart(t *testing.T) {
27 27
 	d.StartWithBusybox(t, "--iptables=false")
28 28
 	defer d.Stop(t)
29 29
 
30
-	client := d.NewClientT(t)
30
+	apiClient := d.NewClientT(t)
31 31
 	ctx := context.Background()
32 32
 
33 33
 	// The intention of this container is to ignore stop signals.
34 34
 	// Sadly this means the test will take longer, but at least this test can be parallelized.
35
-	id := container.Run(ctx, t, client, container.WithCmd("/bin/sh", "-c", "while true; do echo hello; sleep 1; done"))
35
+	id := container.Run(ctx, t, apiClient, container.WithCmd("/bin/sh", "-c", "while true; do echo hello; sleep 1; done"))
36 36
 	defer func() {
37
-		err := client.ContainerRemove(ctx, id, types.ContainerRemoveOptions{Force: true})
37
+		err := apiClient.ContainerRemove(ctx, id, types.ContainerRemoveOptions{Force: true})
38 38
 		assert.NilError(t, err)
39 39
 	}()
40 40
 
41
-	inspect, err := client.ContainerInspect(ctx, id)
41
+	inspect, err := apiClient.ContainerInspect(ctx, id)
42 42
 	assert.NilError(t, err)
43 43
 	assert.Assert(t, inspect.State.Running)
44 44
 
45 45
 	assert.NilError(t, d.Kill())
46 46
 	d.Start(t, "--iptables=false")
47 47
 
48
-	inspect, err = client.ContainerInspect(ctx, id)
48
+	inspect, err = apiClient.ContainerInspect(ctx, id)
49 49
 	assert.Check(t, is.Nil(err))
50 50
 	assert.Assert(t, !inspect.State.Running)
51 51
 }
... ...
@@ -19,7 +19,7 @@ import (
19 19
 func TestWindowsDevices(t *testing.T) {
20 20
 	skip.If(t, testEnv.DaemonInfo.OSType != "windows")
21 21
 	t.Cleanup(setupTest(t))
22
-	client := testEnv.APIClient()
22
+	apiClient := testEnv.APIClient()
23 23
 	ctx := context.Background()
24 24
 
25 25
 	testData := []struct {
... ...
@@ -95,14 +95,14 @@ func TestWindowsDevices(t *testing.T) {
95 95
 				deviceOptions = append(deviceOptions, container.WithWindowsDevice(deviceName))
96 96
 			}
97 97
 
98
-			id := container.Create(ctx, t, client, deviceOptions...)
98
+			id := container.Create(ctx, t, apiClient, deviceOptions...)
99 99
 
100 100
 			// Hyper-V isolation is failing even with no actual devices added.
101 101
 			// TODO: Once https://github.com/moby/moby/issues/43395 is resolved,
102 102
 			// remove this skip.If and validate the expected behaviour under Hyper-V.
103 103
 			skip.If(t, d.isolation == containertypes.IsolationHyperV && !d.expectedStartFailure, "FIXME. HyperV isolation setup is probably incorrect in the test")
104 104
 
105
-			err := client.ContainerStart(ctx, id, types.ContainerStartOptions{})
105
+			err := apiClient.ContainerStart(ctx, id, types.ContainerStartOptions{})
106 106
 			if d.expectedStartFailure {
107 107
 				assert.ErrorContains(t, err, d.expectedStartFailureMessage)
108 108
 				return
... ...
@@ -110,11 +110,11 @@ func TestWindowsDevices(t *testing.T) {
110 110
 
111 111
 			assert.NilError(t, err)
112 112
 
113
-			poll.WaitOn(t, container.IsInState(ctx, client, id, "running"), poll.WithDelay(100*time.Millisecond))
113
+			poll.WaitOn(t, container.IsInState(ctx, apiClient, id, "running"), poll.WithDelay(100*time.Millisecond))
114 114
 
115 115
 			// /Windows/System32/HostDriverStore is mounted from the host when class GUID 5B45201D-F2F2-4F3B-85BB-30FF1F953599
116 116
 			// is mounted. See `C:\windows\System32\containers\devices.def` on a Windows host for (slightly more) details.
117
-			res, err := container.Exec(ctx, client, id, []string{
117
+			res, err := container.Exec(ctx, apiClient, id, []string{
118 118
 				"sh", "-c",
119 119
 				"ls -d /Windows/System32/HostDriverStore/* | grep /Windows/System32/HostDriverStore/FileRepository",
120 120
 			})
... ...
@@ -15,10 +15,10 @@ import (
15 15
 func TestDiff(t *testing.T) {
16 16
 	skip.If(t, testEnv.DaemonInfo.OSType == "windows", "FIXME")
17 17
 	defer setupTest(t)()
18
-	client := testEnv.APIClient()
18
+	apiClient := testEnv.APIClient()
19 19
 	ctx := context.Background()
20 20
 
21
-	cID := container.Run(ctx, t, client, container.WithCmd("sh", "-c", `mkdir /foo; echo xyzzy > /foo/bar`))
21
+	cID := container.Run(ctx, t, apiClient, container.WithCmd("sh", "-c", `mkdir /foo; echo xyzzy > /foo/bar`))
22 22
 
23 23
 	// Wait for it to exit as cannot diff a running container on Windows, and
24 24
 	// it will take a few seconds to exit. Also there's no way in Windows to
... ...
@@ -29,14 +29,14 @@ func TestDiff(t *testing.T) {
29 29
 		{Kind: containertypes.ChangeAdd, Path: "/foo/bar"},
30 30
 	}
31 31
 	if testEnv.DaemonInfo.OSType == "windows" {
32
-		poll.WaitOn(t, container.IsInState(ctx, client, cID, "exited"), poll.WithDelay(100*time.Millisecond), poll.WithTimeout(60*time.Second))
32
+		poll.WaitOn(t, container.IsInState(ctx, apiClient, cID, "exited"), poll.WithDelay(100*time.Millisecond), poll.WithTimeout(60*time.Second))
33 33
 		expected = []containertypes.FilesystemChange{
34 34
 			{Kind: containertypes.ChangeModify, Path: "Files/foo"},
35 35
 			{Kind: containertypes.ChangeModify, Path: "Files/foo/bar"},
36 36
 		}
37 37
 	}
38 38
 
39
-	items, err := client.ContainerDiff(ctx, cID)
39
+	items, err := apiClient.ContainerDiff(ctx, cID)
40 40
 	assert.NilError(t, err)
41 41
 	assert.DeepEqual(t, expected, items)
42 42
 }
... ...
@@ -17,12 +17,12 @@ func TestExecConsoleSize(t *testing.T) {
17 17
 	skip.If(t, versions.LessThan(testEnv.DaemonAPIVersion(), "1.42"), "skip test from new feature")
18 18
 
19 19
 	defer setupTest(t)()
20
-	client := testEnv.APIClient()
20
+	apiClient := testEnv.APIClient()
21 21
 	ctx := context.Background()
22 22
 
23
-	cID := container.Run(ctx, t, client, container.WithImage("busybox"))
23
+	cID := container.Run(ctx, t, apiClient, container.WithImage("busybox"))
24 24
 
25
-	result, err := container.Exec(ctx, client, cID, []string{"stty", "size"},
25
+	result, err := container.Exec(ctx, apiClient, cID, []string{"stty", "size"},
26 26
 		func(ec *types.ExecConfig) {
27 27
 			ec.Tty = true
28 28
 			ec.ConsoleSize = &[2]uint{57, 123}
... ...
@@ -22,13 +22,13 @@ func TestExecWithCloseStdin(t *testing.T) {
22 22
 	defer setupTest(t)()
23 23
 
24 24
 	ctx := context.Background()
25
-	client := testEnv.APIClient()
25
+	apiClient := testEnv.APIClient()
26 26
 
27 27
 	// run top with detached mode
28
-	cID := container.Run(ctx, t, client)
28
+	cID := container.Run(ctx, t, apiClient)
29 29
 
30 30
 	expected := "closeIO"
31
-	execResp, err := client.ContainerExecCreate(ctx, cID,
31
+	execResp, err := apiClient.ContainerExecCreate(ctx, cID,
32 32
 		types.ExecConfig{
33 33
 			AttachStdin:  true,
34 34
 			AttachStdout: true,
... ...
@@ -37,7 +37,7 @@ func TestExecWithCloseStdin(t *testing.T) {
37 37
 	)
38 38
 	assert.NilError(t, err)
39 39
 
40
-	resp, err := client.ContainerExecAttach(ctx, execResp.ID,
40
+	resp, err := apiClient.ContainerExecAttach(ctx, execResp.ID,
41 41
 		types.ExecStartCheck{
42 42
 			Detach: false,
43 43
 			Tty:    false,
... ...
@@ -88,11 +88,11 @@ func TestExec(t *testing.T) {
88 88
 	skip.If(t, versions.LessThan(testEnv.DaemonAPIVersion(), "1.35"), "broken in earlier versions")
89 89
 	defer setupTest(t)()
90 90
 	ctx := context.Background()
91
-	client := testEnv.APIClient()
91
+	apiClient := testEnv.APIClient()
92 92
 
93
-	cID := container.Run(ctx, t, client, container.WithTty(true), container.WithWorkingDir("/root"))
93
+	cID := container.Run(ctx, t, apiClient, container.WithTty(true), container.WithWorkingDir("/root"))
94 94
 
95
-	id, err := client.ContainerExecCreate(ctx, cID,
95
+	id, err := apiClient.ContainerExecCreate(ctx, cID,
96 96
 		types.ExecConfig{
97 97
 			WorkingDir:   "/tmp",
98 98
 			Env:          strslice.StrSlice([]string{"FOO=BAR"}),
... ...
@@ -102,11 +102,11 @@ func TestExec(t *testing.T) {
102 102
 	)
103 103
 	assert.NilError(t, err)
104 104
 
105
-	inspect, err := client.ContainerExecInspect(ctx, id.ID)
105
+	inspect, err := apiClient.ContainerExecInspect(ctx, id.ID)
106 106
 	assert.NilError(t, err)
107 107
 	assert.Check(t, is.Equal(inspect.ExecID, id.ID))
108 108
 
109
-	resp, err := client.ContainerExecAttach(ctx, id.ID,
109
+	resp, err := apiClient.ContainerExecAttach(ctx, id.ID,
110 110
 		types.ExecStartCheck{
111 111
 			Detach: false,
112 112
 			Tty:    false,
... ...
@@ -131,11 +131,11 @@ func TestExecUser(t *testing.T) {
131 131
 	skip.If(t, testEnv.DaemonInfo.OSType == "windows", "FIXME. Probably needs to wait for container to be in running state.")
132 132
 	defer setupTest(t)()
133 133
 	ctx := context.Background()
134
-	client := testEnv.APIClient()
134
+	apiClient := testEnv.APIClient()
135 135
 
136
-	cID := container.Run(ctx, t, client, container.WithTty(true), container.WithUser("1:1"))
136
+	cID := container.Run(ctx, t, apiClient, container.WithTty(true), container.WithUser("1:1"))
137 137
 
138
-	result, err := container.Exec(ctx, client, cID, []string{"id"})
138
+	result, err := container.Exec(ctx, apiClient, cID, []string{"id"})
139 139
 	assert.NilError(t, err)
140 140
 
141 141
 	assert.Assert(t, is.Contains(result.Stdout(), "uid=1(daemon) gid=1(daemon)"), "exec command not running as uid/gid 1")
... ...
@@ -23,16 +23,16 @@ func TestExportContainerAndImportImage(t *testing.T) {
23 23
 	skip.If(t, testEnv.DaemonInfo.OSType == "windows")
24 24
 
25 25
 	defer setupTest(t)()
26
-	client := testEnv.APIClient()
26
+	apiClient := testEnv.APIClient()
27 27
 	ctx := context.Background()
28 28
 
29
-	cID := container.Run(ctx, t, client, container.WithCmd("true"))
30
-	poll.WaitOn(t, container.IsStopped(ctx, client, cID), poll.WithDelay(100*time.Millisecond))
29
+	cID := container.Run(ctx, t, apiClient, container.WithCmd("true"))
30
+	poll.WaitOn(t, container.IsStopped(ctx, apiClient, cID), poll.WithDelay(100*time.Millisecond))
31 31
 
32 32
 	reference := "repo/" + strings.ToLower(t.Name()) + ":v1"
33
-	exportResp, err := client.ContainerExport(ctx, cID)
33
+	exportResp, err := apiClient.ContainerExport(ctx, cID)
34 34
 	assert.NilError(t, err)
35
-	importResp, err := client.ImageImport(ctx, types.ImageImportSource{
35
+	importResp, err := apiClient.ImageImport(ctx, types.ImageImportSource{
36 36
 		Source:     exportResp,
37 37
 		SourceName: "-",
38 38
 	}, reference, types.ImageImportOptions{})
... ...
@@ -46,7 +46,7 @@ func TestExportContainerAndImportImage(t *testing.T) {
46 46
 	err = dec.Decode(&jm)
47 47
 	assert.NilError(t, err)
48 48
 
49
-	images, err := client.ImageList(ctx, types.ImageListOptions{
49
+	images, err := apiClient.ImageList(ctx, types.ImageListOptions{
50 50
 		Filters: filters.NewArgs(filters.Arg("reference", reference)),
51 51
 	})
52 52
 	assert.NilError(t, err)
... ...
@@ -21,9 +21,9 @@ func TestHealthCheckWorkdir(t *testing.T) {
21 21
 	skip.If(t, testEnv.DaemonInfo.OSType == "windows", "FIXME")
22 22
 	defer setupTest(t)()
23 23
 	ctx := context.Background()
24
-	client := testEnv.APIClient()
24
+	apiClient := testEnv.APIClient()
25 25
 
26
-	cID := container.Run(ctx, t, client, container.WithTty(true), container.WithWorkingDir("/foo"), func(c *container.TestContainerConfig) {
26
+	cID := container.Run(ctx, t, apiClient, container.WithTty(true), container.WithWorkingDir("/foo"), func(c *container.TestContainerConfig) {
27 27
 		c.Config.Healthcheck = &containertypes.HealthConfig{
28 28
 			Test:     []string{"CMD-SHELL", "if [ \"$PWD\" = \"/foo\" ]; then exit 0; else exit 1; fi;"},
29 29
 			Interval: 50 * time.Millisecond,
... ...
@@ -31,7 +31,7 @@ func TestHealthCheckWorkdir(t *testing.T) {
31 31
 		}
32 32
 	})
33 33
 
34
-	poll.WaitOn(t, pollForHealthStatus(ctx, client, cID, types.Healthy), poll.WithDelay(100*time.Millisecond))
34
+	poll.WaitOn(t, pollForHealthStatus(ctx, apiClient, cID, types.Healthy), poll.WithDelay(100*time.Millisecond))
35 35
 }
36 36
 
37 37
 // GitHub #37263
... ...
@@ -41,9 +41,9 @@ func TestHealthKillContainer(t *testing.T) {
41 41
 	defer setupTest(t)()
42 42
 
43 43
 	ctx := context.Background()
44
-	client := testEnv.APIClient()
44
+	apiClient := testEnv.APIClient()
45 45
 
46
-	id := container.Run(ctx, t, client, func(c *container.TestContainerConfig) {
46
+	id := container.Run(ctx, t, apiClient, func(c *container.TestContainerConfig) {
47 47
 		cmd := `
48 48
 # Set the initial HEALTH value so the healthcheck passes
49 49
 HEALTH="1"
... ...
@@ -77,21 +77,21 @@ while true; do sleep 1; done
77 77
 
78 78
 	ctxPoll, cancel := context.WithTimeout(ctx, 30*time.Second)
79 79
 	defer cancel()
80
-	poll.WaitOn(t, pollForHealthStatus(ctxPoll, client, id, "healthy"), poll.WithDelay(100*time.Millisecond))
80
+	poll.WaitOn(t, pollForHealthStatus(ctxPoll, apiClient, id, "healthy"), poll.WithDelay(100*time.Millisecond))
81 81
 
82
-	err := client.ContainerKill(ctx, id, "SIGUSR1")
82
+	err := apiClient.ContainerKill(ctx, id, "SIGUSR1")
83 83
 	assert.NilError(t, err)
84 84
 
85 85
 	ctxPoll, cancel = context.WithTimeout(ctx, 30*time.Second)
86 86
 	defer cancel()
87
-	poll.WaitOn(t, pollForHealthStatus(ctxPoll, client, id, "unhealthy"), poll.WithDelay(100*time.Millisecond))
87
+	poll.WaitOn(t, pollForHealthStatus(ctxPoll, apiClient, id, "unhealthy"), poll.WithDelay(100*time.Millisecond))
88 88
 
89
-	err = client.ContainerKill(ctx, id, "SIGUSR1")
89
+	err = apiClient.ContainerKill(ctx, id, "SIGUSR1")
90 90
 	assert.NilError(t, err)
91 91
 
92 92
 	ctxPoll, cancel = context.WithTimeout(ctx, 30*time.Second)
93 93
 	defer cancel()
94
-	poll.WaitOn(t, pollForHealthStatus(ctxPoll, client, id, "healthy"), poll.WithDelay(100*time.Millisecond))
94
+	poll.WaitOn(t, pollForHealthStatus(ctxPoll, apiClient, id, "healthy"), poll.WithDelay(100*time.Millisecond))
95 95
 }
96 96
 
97 97
 // TestHealthCheckProcessKilled verifies that health-checks exec get killed on time-out.
... ...
@@ -115,10 +115,10 @@ func TestHealthStartInterval(t *testing.T) {
115 115
 	skip.If(t, testEnv.DaemonInfo.OSType == "windows", "The shell commands used in the test healthcheck do not work on Windows")
116 116
 	defer setupTest(t)()
117 117
 	ctx := context.Background()
118
-	client := testEnv.APIClient()
118
+	apiClient := testEnv.APIClient()
119 119
 
120 120
 	// Note: Windows is much slower than linux so this use longer intervals/timeouts
121
-	id := container.Run(ctx, t, client, func(c *container.TestContainerConfig) {
121
+	id := container.Run(ctx, t, apiClient, func(c *container.TestContainerConfig) {
122 122
 		c.Config.Healthcheck = &containertypes.HealthConfig{
123 123
 			Test:          []string{"CMD-SHELL", `count="$(cat /tmp/health)"; if [ -z "${count}" ]; then let count=0; fi; let count=${count}+1; echo -n ${count} | tee /tmp/health; if [ ${count} -lt 3 ]; then exit 1; fi`},
124 124
 			Interval:      30 * time.Second,
... ...
@@ -136,7 +136,7 @@ func TestHealthStartInterval(t *testing.T) {
136 136
 		if ctxPoll.Err() != nil {
137 137
 			return poll.Error(ctxPoll.Err())
138 138
 		}
139
-		inspect, err := client.ContainerInspect(ctxPoll, id)
139
+		inspect, err := apiClient.ContainerInspect(ctxPoll, id)
140 140
 		if err != nil {
141 141
 			return poll.Error(err)
142 142
 		}
... ...
@@ -155,7 +155,7 @@ func TestHealthStartInterval(t *testing.T) {
155 155
 	dl, _ = ctxPoll.Deadline()
156 156
 
157 157
 	poll.WaitOn(t, func(log poll.LogT) poll.Result {
158
-		inspect, err := client.ContainerInspect(ctxPoll, id)
158
+		inspect, err := apiClient.ContainerInspect(ctxPoll, id)
159 159
 		if err != nil {
160 160
 			return poll.Error(err)
161 161
 		}
... ...
@@ -20,7 +20,7 @@ func TestInspectCpusetInConfigPre120(t *testing.T) {
20 20
 	skip.If(t, testEnv.DaemonInfo.OSType == "windows" || !testEnv.DaemonInfo.CPUSet)
21 21
 
22 22
 	defer setupTest(t)()
23
-	client := request.NewAPIClient(t, client.WithVersion("1.19"))
23
+	apiClient := request.NewAPIClient(t, client.WithVersion("1.19"))
24 24
 	ctx := context.Background()
25 25
 
26 26
 	name := strings.ToLower(t.Name())
... ...
@@ -31,9 +31,9 @@ func TestInspectCpusetInConfigPre120(t *testing.T) {
31 31
 			c.HostConfig.Resources.CpusetCpus = "0"
32 32
 		},
33 33
 	)
34
-	poll.WaitOn(t, container.IsInState(ctx, client, name, "exited"), poll.WithDelay(100*time.Millisecond))
34
+	poll.WaitOn(t, container.IsInState(ctx, apiClient, name, "exited"), poll.WithDelay(100*time.Millisecond))
35 35
 
36
-	_, body, err := client.ContainerInspectWithRaw(ctx, name, false)
36
+	_, body, err := apiClient.ContainerInspectWithRaw(ctx, name, false)
37 37
 	assert.NilError(t, err)
38 38
 
39 39
 	var inspectJSON map[string]interface{}
... ...
@@ -50,7 +50,7 @@ func TestInspectCpusetInConfigPre120(t *testing.T) {
50 50
 
51 51
 func TestInspectAnnotations(t *testing.T) {
52 52
 	defer setupTest(t)()
53
-	client := request.NewAPIClient(t)
53
+	apiClient := request.NewAPIClient(t)
54 54
 	ctx := context.Background()
55 55
 
56 56
 	annotations := map[string]string{
... ...
@@ -59,7 +59,7 @@ func TestInspectAnnotations(t *testing.T) {
59 59
 	}
60 60
 
61 61
 	name := strings.ToLower(t.Name())
62
-	id := container.Create(ctx, t, client,
62
+	id := container.Create(ctx, t, apiClient,
63 63
 		container.WithName(name),
64 64
 		container.WithCmd("true"),
65 65
 		func(c *container.TestContainerConfig) {
... ...
@@ -67,7 +67,7 @@ func TestInspectAnnotations(t *testing.T) {
67 67
 		},
68 68
 	)
69 69
 
70
-	inspect, err := client.ContainerInspect(ctx, id)
70
+	inspect, err := apiClient.ContainerInspect(ctx, id)
71 71
 	assert.NilError(t, err)
72 72
 	assert.Check(t, is.DeepEqual(inspect.HostConfig.Annotations, annotations))
73 73
 }
... ...
@@ -62,19 +62,19 @@ func testIpcNonePrivateShareable(t *testing.T, mode string, mustBeMounted bool,
62 62
 	hostCfg := containertypes.HostConfig{
63 63
 		IpcMode: containertypes.IpcMode(mode),
64 64
 	}
65
-	client := testEnv.APIClient()
65
+	apiClient := testEnv.APIClient()
66 66
 	ctx := context.Background()
67 67
 
68
-	resp, err := client.ContainerCreate(ctx, &cfg, &hostCfg, nil, nil, "")
68
+	resp, err := apiClient.ContainerCreate(ctx, &cfg, &hostCfg, nil, nil, "")
69 69
 	assert.NilError(t, err)
70 70
 	assert.Check(t, is.Equal(len(resp.Warnings), 0))
71 71
 
72
-	err = client.ContainerStart(ctx, resp.ID, types.ContainerStartOptions{})
72
+	err = apiClient.ContainerStart(ctx, resp.ID, types.ContainerStartOptions{})
73 73
 	assert.NilError(t, err)
74 74
 
75 75
 	// get major:minor pair for /dev/shm from container's /proc/self/mountinfo
76 76
 	cmd := "awk '($5 == \"/dev/shm\") {printf $3}' /proc/self/mountinfo"
77
-	result, err := container.Exec(ctx, client, resp.ID, []string{"sh", "-c", cmd})
77
+	result, err := container.Exec(ctx, apiClient, resp.ID, []string{"sh", "-c", cmd})
78 78
 	assert.NilError(t, err)
79 79
 	mm := result.Combined()
80 80
 	if !mustBeMounted {
... ...
@@ -134,25 +134,25 @@ func testIpcContainer(t *testing.T, donorMode string, mustWork bool) {
134 134
 		IpcMode: containertypes.IpcMode(donorMode),
135 135
 	}
136 136
 	ctx := context.Background()
137
-	client := testEnv.APIClient()
137
+	apiClient := testEnv.APIClient()
138 138
 
139 139
 	// create and start the "donor" container
140
-	resp, err := client.ContainerCreate(ctx, &cfg, &hostCfg, nil, nil, "")
140
+	resp, err := apiClient.ContainerCreate(ctx, &cfg, &hostCfg, nil, nil, "")
141 141
 	assert.NilError(t, err)
142 142
 	assert.Check(t, is.Equal(len(resp.Warnings), 0))
143 143
 	name1 := resp.ID
144 144
 
145
-	err = client.ContainerStart(ctx, name1, types.ContainerStartOptions{})
145
+	err = apiClient.ContainerStart(ctx, name1, types.ContainerStartOptions{})
146 146
 	assert.NilError(t, err)
147 147
 
148 148
 	// create and start the second container
149 149
 	hostCfg.IpcMode = containertypes.IpcMode("container:" + name1)
150
-	resp, err = client.ContainerCreate(ctx, &cfg, &hostCfg, nil, nil, "")
150
+	resp, err = apiClient.ContainerCreate(ctx, &cfg, &hostCfg, nil, nil, "")
151 151
 	assert.NilError(t, err)
152 152
 	assert.Check(t, is.Equal(len(resp.Warnings), 0))
153 153
 	name2 := resp.ID
154 154
 
155
-	err = client.ContainerStart(ctx, name2, types.ContainerStartOptions{})
155
+	err = apiClient.ContainerStart(ctx, name2, types.ContainerStartOptions{})
156 156
 	if !mustWork {
157 157
 		// start should fail with a specific error
158 158
 		assert.Check(t, is.ErrorContains(err, "non-shareable IPC"))
... ...
@@ -165,10 +165,10 @@ func testIpcContainer(t *testing.T, donorMode string, mustWork bool) {
165 165
 
166 166
 	// check that IPC is shared
167 167
 	// 1. create a file in the first container
168
-	_, err = container.Exec(ctx, client, name1, []string{"sh", "-c", "printf covfefe > /dev/shm/bar"})
168
+	_, err = container.Exec(ctx, apiClient, name1, []string{"sh", "-c", "printf covfefe > /dev/shm/bar"})
169 169
 	assert.NilError(t, err)
170 170
 	// 2. check it's the same file in the second one
171
-	result, err := container.Exec(ctx, client, name2, []string{"cat", "/dev/shm/bar"})
171
+	result, err := container.Exec(ctx, apiClient, name2, []string{"cat", "/dev/shm/bar"})
172 172
 	assert.NilError(t, err)
173 173
 	out := result.Combined()
174 174
 	assert.Check(t, is.Equal(true, regexp.MustCompile("^covfefe$").MatchString(out)))
... ...
@@ -201,25 +201,25 @@ func TestAPIIpcModeHost(t *testing.T) {
201 201
 	}
202 202
 	ctx := context.Background()
203 203
 
204
-	client := testEnv.APIClient()
205
-	resp, err := client.ContainerCreate(ctx, &cfg, &hostCfg, nil, nil, "")
204
+	apiClient := testEnv.APIClient()
205
+	resp, err := apiClient.ContainerCreate(ctx, &cfg, &hostCfg, nil, nil, "")
206 206
 	assert.NilError(t, err)
207 207
 	assert.Check(t, is.Equal(len(resp.Warnings), 0))
208 208
 	name := resp.ID
209 209
 
210
-	err = client.ContainerStart(ctx, name, types.ContainerStartOptions{})
210
+	err = apiClient.ContainerStart(ctx, name, types.ContainerStartOptions{})
211 211
 	assert.NilError(t, err)
212 212
 
213 213
 	// check that IPC is shared
214 214
 	// 1. create a file inside container
215
-	_, err = container.Exec(ctx, client, name, []string{"sh", "-c", "printf covfefe > /dev/shm/." + name})
215
+	_, err = container.Exec(ctx, apiClient, name, []string{"sh", "-c", "printf covfefe > /dev/shm/." + name})
216 216
 	assert.NilError(t, err)
217 217
 	// 2. check it's the same on the host
218 218
 	bytes, err := os.ReadFile("/dev/shm/." + name)
219 219
 	assert.NilError(t, err)
220 220
 	assert.Check(t, is.Equal("covfefe", string(bytes)))
221 221
 	// 3. clean up
222
-	_, err = container.Exec(ctx, client, name, []string{"rm", "-f", "/dev/shm/." + name})
222
+	_, err = container.Exec(ctx, apiClient, name, []string{"rm", "-f", "/dev/shm/." + name})
223 223
 	assert.NilError(t, err)
224 224
 }
225 225
 
... ...
@@ -303,25 +303,25 @@ func TestDaemonIpcModeShareableFromConfig(t *testing.T) {
303 303
 // by default, even when the daemon default is private.
304 304
 func TestIpcModeOlderClient(t *testing.T) {
305 305
 	skip.If(t, versions.LessThan(testEnv.DaemonAPIVersion(), "1.40"), "requires a daemon with DefaultIpcMode: private")
306
-	c := testEnv.APIClient()
307
-	skip.If(t, versions.LessThan(c.ClientVersion(), "1.40"), "requires client API >= 1.40")
306
+	apiClient := testEnv.APIClient()
307
+	skip.If(t, versions.LessThan(apiClient.ClientVersion(), "1.40"), "requires client API >= 1.40")
308 308
 
309 309
 	t.Parallel()
310 310
 
311 311
 	ctx := context.Background()
312 312
 
313 313
 	// pre-check: default ipc mode in daemon is private
314
-	cID := container.Create(ctx, t, c, container.WithAutoRemove)
314
+	cID := container.Create(ctx, t, apiClient, container.WithAutoRemove)
315 315
 
316
-	inspect, err := c.ContainerInspect(ctx, cID)
316
+	inspect, err := apiClient.ContainerInspect(ctx, cID)
317 317
 	assert.NilError(t, err)
318 318
 	assert.Check(t, is.Equal(string(inspect.HostConfig.IpcMode), "private"))
319 319
 
320 320
 	// main check: using older client creates "shareable" container
321
-	c = request.NewAPIClient(t, client.WithVersion("1.39"))
322
-	cID = container.Create(ctx, t, c, container.WithAutoRemove)
321
+	apiClient = request.NewAPIClient(t, client.WithVersion("1.39"))
322
+	cID = container.Create(ctx, t, apiClient, container.WithAutoRemove)
323 323
 
324
-	inspect, err = c.ContainerInspect(ctx, cID)
324
+	inspect, err = apiClient.ContainerInspect(ctx, cID)
325 325
 	assert.NilError(t, err)
326 326
 	assert.Check(t, is.Equal(string(inspect.HostConfig.IpcMode), "shareable"))
327 327
 }
... ...
@@ -17,24 +17,24 @@ import (
17 17
 
18 18
 func TestKillContainerInvalidSignal(t *testing.T) {
19 19
 	defer setupTest(t)()
20
-	client := testEnv.APIClient()
20
+	apiClient := testEnv.APIClient()
21 21
 	ctx := context.Background()
22
-	id := container.Run(ctx, t, client)
22
+	id := container.Run(ctx, t, apiClient)
23 23
 
24
-	err := client.ContainerKill(ctx, id, "0")
24
+	err := apiClient.ContainerKill(ctx, id, "0")
25 25
 	assert.ErrorContains(t, err, "Error response from daemon:")
26 26
 	assert.ErrorContains(t, err, "nvalid signal: 0") // match "(I|i)nvalid" case-insensitive to allow testing against older daemons.
27
-	poll.WaitOn(t, container.IsInState(ctx, client, id, "running"), poll.WithDelay(100*time.Millisecond))
27
+	poll.WaitOn(t, container.IsInState(ctx, apiClient, id, "running"), poll.WithDelay(100*time.Millisecond))
28 28
 
29
-	err = client.ContainerKill(ctx, id, "SIG42")
29
+	err = apiClient.ContainerKill(ctx, id, "SIG42")
30 30
 	assert.ErrorContains(t, err, "Error response from daemon:")
31 31
 	assert.ErrorContains(t, err, "nvalid signal: SIG42") // match "(I|i)nvalid" case-insensitive to allow testing against older daemons.
32
-	poll.WaitOn(t, container.IsInState(ctx, client, id, "running"), poll.WithDelay(100*time.Millisecond))
32
+	poll.WaitOn(t, container.IsInState(ctx, apiClient, id, "running"), poll.WithDelay(100*time.Millisecond))
33 33
 }
34 34
 
35 35
 func TestKillContainer(t *testing.T) {
36 36
 	defer setupTest(t)()
37
-	client := testEnv.APIClient()
37
+	apiClient := testEnv.APIClient()
38 38
 
39 39
 	testCases := []struct {
40 40
 		doc    string
... ...
@@ -72,18 +72,18 @@ func TestKillContainer(t *testing.T) {
72 72
 		t.Run(tc.doc, func(t *testing.T) {
73 73
 			skip.If(t, testEnv.DaemonInfo.OSType == tc.skipOs, "Windows does not support SIGWINCH")
74 74
 			ctx := context.Background()
75
-			id := container.Run(ctx, t, client)
76
-			err := client.ContainerKill(ctx, id, tc.signal)
75
+			id := container.Run(ctx, t, apiClient)
76
+			err := apiClient.ContainerKill(ctx, id, tc.signal)
77 77
 			assert.NilError(t, err)
78 78
 
79
-			poll.WaitOn(t, container.IsInState(ctx, client, id, tc.status), pollOpts...)
79
+			poll.WaitOn(t, container.IsInState(ctx, apiClient, id, tc.status), pollOpts...)
80 80
 		})
81 81
 	}
82 82
 }
83 83
 
84 84
 func TestKillWithStopSignalAndRestartPolicies(t *testing.T) {
85 85
 	defer setupTest(t)()
86
-	client := testEnv.APIClient()
86
+	apiClient := testEnv.APIClient()
87 87
 
88 88
 	testCases := []struct {
89 89
 		doc        string
... ...
@@ -111,15 +111,15 @@ func TestKillWithStopSignalAndRestartPolicies(t *testing.T) {
111 111
 		tc := tc
112 112
 		t.Run(tc.doc, func(t *testing.T) {
113 113
 			ctx := context.Background()
114
-			id := container.Run(ctx, t, client,
114
+			id := container.Run(ctx, t, apiClient,
115 115
 				container.WithRestartPolicy("always"),
116 116
 				func(c *container.TestContainerConfig) {
117 117
 					c.Config.StopSignal = tc.stopsignal
118 118
 				})
119
-			err := client.ContainerKill(ctx, id, "TERM")
119
+			err := apiClient.ContainerKill(ctx, id, "TERM")
120 120
 			assert.NilError(t, err)
121 121
 
122
-			poll.WaitOn(t, container.IsInState(ctx, client, id, tc.status), pollOpts...)
122
+			poll.WaitOn(t, container.IsInState(ctx, apiClient, id, tc.status), pollOpts...)
123 123
 		})
124 124
 	}
125 125
 }
... ...
@@ -127,9 +127,9 @@ func TestKillWithStopSignalAndRestartPolicies(t *testing.T) {
127 127
 func TestKillStoppedContainer(t *testing.T) {
128 128
 	defer setupTest(t)()
129 129
 	ctx := context.Background()
130
-	client := testEnv.APIClient()
131
-	id := container.Create(ctx, t, client)
132
-	err := client.ContainerKill(ctx, id, "SIGKILL")
130
+	apiClient := testEnv.APIClient()
131
+	id := container.Create(ctx, t, apiClient)
132
+	err := apiClient.ContainerKill(ctx, id, "SIGKILL")
133 133
 	assert.Assert(t, is.ErrorContains(err, ""))
134 134
 	assert.Assert(t, is.Contains(err.Error(), "is not running"))
135 135
 }
... ...
@@ -138,9 +138,9 @@ func TestKillStoppedContainerAPIPre120(t *testing.T) {
138 138
 	skip.If(t, testEnv.DaemonInfo.OSType == "windows", "Windows only supports 1.25 or later")
139 139
 	defer setupTest(t)()
140 140
 	ctx := context.Background()
141
-	client := request.NewAPIClient(t, client.WithVersion("1.19"))
142
-	id := container.Create(ctx, t, client)
143
-	err := client.ContainerKill(ctx, id, "SIGKILL")
141
+	apiClient := request.NewAPIClient(t, client.WithVersion("1.19"))
142
+	id := container.Create(ctx, t, apiClient)
143
+	err := apiClient.ContainerKill(ctx, id, "SIGKILL")
144 144
 	assert.NilError(t, err)
145 145
 }
146 146
 
... ...
@@ -150,16 +150,16 @@ func TestKillDifferentUserContainer(t *testing.T) {
150 150
 
151 151
 	defer setupTest(t)()
152 152
 	ctx := context.Background()
153
-	client := request.NewAPIClient(t, client.WithVersion("1.19"))
153
+	apiClient := request.NewAPIClient(t, client.WithVersion("1.19"))
154 154
 
155
-	id := container.Run(ctx, t, client, func(c *container.TestContainerConfig) {
155
+	id := container.Run(ctx, t, apiClient, func(c *container.TestContainerConfig) {
156 156
 		c.Config.User = "daemon"
157 157
 	})
158
-	poll.WaitOn(t, container.IsInState(ctx, client, id, "running"), poll.WithDelay(100*time.Millisecond))
158
+	poll.WaitOn(t, container.IsInState(ctx, apiClient, id, "running"), poll.WithDelay(100*time.Millisecond))
159 159
 
160
-	err := client.ContainerKill(ctx, id, "SIGKILL")
160
+	err := apiClient.ContainerKill(ctx, id, "SIGKILL")
161 161
 	assert.NilError(t, err)
162
-	poll.WaitOn(t, container.IsInState(ctx, client, id, "exited"), poll.WithDelay(100*time.Millisecond))
162
+	poll.WaitOn(t, container.IsInState(ctx, apiClient, id, "exited"), poll.WithDelay(100*time.Millisecond))
163 163
 }
164 164
 
165 165
 func TestInspectOomKilledTrue(t *testing.T) {
... ...
@@ -170,15 +170,15 @@ func TestInspectOomKilledTrue(t *testing.T) {
170 170
 
171 171
 	defer setupTest(t)()
172 172
 	ctx := context.Background()
173
-	client := testEnv.APIClient()
173
+	apiClient := testEnv.APIClient()
174 174
 
175
-	cID := container.Run(ctx, t, client, container.WithCmd("sh", "-c", "x=a; while true; do x=$x$x$x$x; done"), func(c *container.TestContainerConfig) {
175
+	cID := container.Run(ctx, t, apiClient, container.WithCmd("sh", "-c", "x=a; while true; do x=$x$x$x$x; done"), func(c *container.TestContainerConfig) {
176 176
 		c.HostConfig.Resources.Memory = 32 * 1024 * 1024
177 177
 	})
178 178
 
179
-	poll.WaitOn(t, container.IsInState(ctx, client, cID, "exited"), poll.WithDelay(100*time.Millisecond))
179
+	poll.WaitOn(t, container.IsInState(ctx, apiClient, cID, "exited"), poll.WithDelay(100*time.Millisecond))
180 180
 
181
-	inspect, err := client.ContainerInspect(ctx, cID)
181
+	inspect, err := apiClient.ContainerInspect(ctx, cID)
182 182
 	assert.NilError(t, err)
183 183
 	assert.Check(t, is.Equal(true, inspect.State.OOMKilled))
184 184
 }
... ...
@@ -188,13 +188,13 @@ func TestInspectOomKilledFalse(t *testing.T) {
188 188
 
189 189
 	defer setupTest(t)()
190 190
 	ctx := context.Background()
191
-	client := testEnv.APIClient()
191
+	apiClient := testEnv.APIClient()
192 192
 
193
-	cID := container.Run(ctx, t, client, container.WithCmd("sh", "-c", "echo hello world"))
193
+	cID := container.Run(ctx, t, apiClient, container.WithCmd("sh", "-c", "echo hello world"))
194 194
 
195
-	poll.WaitOn(t, container.IsInState(ctx, client, cID, "exited"), poll.WithDelay(100*time.Millisecond))
195
+	poll.WaitOn(t, container.IsInState(ctx, apiClient, cID, "exited"), poll.WithDelay(100*time.Millisecond))
196 196
 
197
-	inspect, err := client.ContainerInspect(ctx, cID)
197
+	inspect, err := apiClient.ContainerInspect(ctx, cID)
198 198
 	assert.NilError(t, err)
199 199
 	assert.Check(t, is.Equal(false, inspect.State.OOMKilled))
200 200
 }
... ...
@@ -21,11 +21,11 @@ func TestLinksEtcHostsContentMatch(t *testing.T) {
21 21
 	skip.If(t, os.IsNotExist(err))
22 22
 
23 23
 	defer setupTest(t)()
24
-	client := testEnv.APIClient()
24
+	apiClient := testEnv.APIClient()
25 25
 	ctx := context.Background()
26 26
 
27
-	cID := container.Run(ctx, t, client, container.WithNetworkMode("host"))
28
-	res, err := container.Exec(ctx, client, cID, []string{"cat", "/etc/hosts"})
27
+	cID := container.Run(ctx, t, apiClient, container.WithNetworkMode("host"))
28
+	res, err := container.Exec(ctx, apiClient, cID, []string{"cat", "/etc/hosts"})
29 29
 	assert.NilError(t, err)
30 30
 	assert.Assert(t, is.Len(res.Stderr(), 0))
31 31
 	assert.Equal(t, 0, res.ExitCode)
... ...
@@ -37,15 +37,15 @@ func TestLinksContainerNames(t *testing.T) {
37 37
 	skip.If(t, testEnv.DaemonInfo.OSType == "windows")
38 38
 
39 39
 	defer setupTest(t)()
40
-	client := testEnv.APIClient()
40
+	apiClient := testEnv.APIClient()
41 41
 	ctx := context.Background()
42 42
 
43 43
 	containerA := "first_" + t.Name()
44 44
 	containerB := "second_" + t.Name()
45
-	container.Run(ctx, t, client, container.WithName(containerA))
46
-	container.Run(ctx, t, client, container.WithName(containerB), container.WithLinks(containerA+":"+containerA))
45
+	container.Run(ctx, t, apiClient, container.WithName(containerA))
46
+	container.Run(ctx, t, apiClient, container.WithName(containerB), container.WithLinks(containerA+":"+containerA))
47 47
 
48
-	containers, err := client.ContainerList(ctx, types.ContainerListOptions{
48
+	containers, err := apiClient.ContainerList(ctx, types.ContainerListOptions{
49 49
 		Filters: filters.NewArgs(filters.Arg("name", containerA)),
50 50
 	})
51 51
 	assert.NilError(t, err)
... ...
@@ -26,12 +26,12 @@ func TestLogsFollowTailEmpty(t *testing.T) {
26 26
 	// FIXME(vdemeester) fails on a e2e run on linux...
27 27
 	skip.If(t, testEnv.IsRemoteDaemon)
28 28
 	defer setupTest(t)()
29
-	client := testEnv.APIClient()
29
+	apiClient := testEnv.APIClient()
30 30
 	ctx := context.Background()
31 31
 
32
-	id := container.Run(ctx, t, client, container.WithCmd("sleep", "100000"))
32
+	id := container.Run(ctx, t, apiClient, container.WithCmd("sleep", "100000"))
33 33
 
34
-	logs, err := client.ContainerLogs(ctx, id, types.ContainerLogsOptions{ShowStdout: true, Tail: "2"})
34
+	logs, err := apiClient.ContainerLogs(ctx, id, types.ContainerLogsOptions{ShowStdout: true, Tail: "2"})
35 35
 	if logs != nil {
36 36
 		defer logs.Close()
37 37
 	}
... ...
@@ -53,7 +53,7 @@ func TestLogs(t *testing.T) {
53 53
 
54 54
 func testLogs(t *testing.T, logDriver string) {
55 55
 	defer setupTest(t)()
56
-	client := testEnv.APIClient()
56
+	apiClient := testEnv.APIClient()
57 57
 	ctx := context.Background()
58 58
 
59 59
 	testCases := []struct {
... ...
@@ -134,18 +134,18 @@ func testLogs(t *testing.T, logDriver string) {
134 134
 		t.Run(tC.desc, func(t *testing.T) {
135 135
 			t.Parallel()
136 136
 			tty := tC.tty
137
-			id := container.Run(ctx, t, client,
137
+			id := container.Run(ctx, t, apiClient,
138 138
 				container.WithCmd("sh", "-c", "echo -n this is fine; echo -n accidents happen >&2"),
139 139
 				container.WithTty(tty),
140 140
 				container.WithLogDriver(logDriver),
141 141
 			)
142
-			defer client.ContainerRemove(ctx, id, types.ContainerRemoveOptions{Force: true})
142
+			defer apiClient.ContainerRemove(ctx, id, types.ContainerRemoveOptions{Force: true})
143 143
 
144
-			poll.WaitOn(t, container.IsStopped(ctx, client, id),
144
+			poll.WaitOn(t, container.IsStopped(ctx, apiClient, id),
145 145
 				poll.WithDelay(time.Millisecond*100),
146 146
 				poll.WithTimeout(pollTimeout))
147 147
 
148
-			logs, err := client.ContainerLogs(ctx, id, tC.logOps)
148
+			logs, err := apiClient.ContainerLogs(ctx, id, tC.logOps)
149 149
 			assert.NilError(t, err)
150 150
 			defer logs.Close()
151 151
 
... ...
@@ -92,9 +92,9 @@ func TestMountDaemonRoot(t *testing.T) {
92 92
 	skip.If(t, testEnv.IsRemoteDaemon)
93 93
 
94 94
 	t.Cleanup(setupTest(t))
95
-	client := testEnv.APIClient()
95
+	apiClient := testEnv.APIClient()
96 96
 	ctx := context.Background()
97
-	info, err := client.Info(ctx)
97
+	info, err := apiClient.Info(ctx)
98 98
 	if err != nil {
99 99
 		t.Fatal(err)
100 100
 	}
... ...
@@ -175,7 +175,7 @@ func TestMountDaemonRoot(t *testing.T) {
175 175
 					hc := hc
176 176
 					t.Parallel()
177 177
 
178
-					c, err := client.ContainerCreate(ctx, &containertypes.Config{
178
+					c, err := apiClient.ContainerCreate(ctx, &containertypes.Config{
179 179
 						Image: "busybox",
180 180
 						Cmd:   []string{"true"},
181 181
 					}, hc, nil, nil, "")
... ...
@@ -191,12 +191,12 @@ func TestMountDaemonRoot(t *testing.T) {
191 191
 					}
192 192
 
193 193
 					defer func() {
194
-						if err := client.ContainerRemove(ctx, c.ID, types.ContainerRemoveOptions{Force: true}); err != nil {
194
+						if err := apiClient.ContainerRemove(ctx, c.ID, types.ContainerRemoveOptions{Force: true}); err != nil {
195 195
 							panic(err)
196 196
 						}
197 197
 					}()
198 198
 
199
-					inspect, err := client.ContainerInspect(ctx, c.ID)
199
+					inspect, err := apiClient.ContainerInspect(ctx, c.ID)
200 200
 					if err != nil {
201 201
 						t.Fatal(err)
202 202
 					}
... ...
@@ -258,15 +258,15 @@ func TestContainerBindMountNonRecursive(t *testing.T) {
258 258
 	nonRecursiveVerifier := []string{"test", "!", "-f", "/foo/mnt/file"}
259 259
 
260 260
 	ctx := context.Background()
261
-	client := testEnv.APIClient()
261
+	apiClient := testEnv.APIClient()
262 262
 	containers := []string{
263
-		container.Run(ctx, t, client, container.WithMount(implicit), container.WithCmd(recursiveVerifier...)),
264
-		container.Run(ctx, t, client, container.WithMount(recursive), container.WithCmd(recursiveVerifier...)),
265
-		container.Run(ctx, t, client, container.WithMount(nonRecursive), container.WithCmd(nonRecursiveVerifier...)),
263
+		container.Run(ctx, t, apiClient, container.WithMount(implicit), container.WithCmd(recursiveVerifier...)),
264
+		container.Run(ctx, t, apiClient, container.WithMount(recursive), container.WithCmd(recursiveVerifier...)),
265
+		container.Run(ctx, t, apiClient, container.WithMount(nonRecursive), container.WithCmd(nonRecursiveVerifier...)),
266 266
 	}
267 267
 
268 268
 	for _, c := range containers {
269
-		poll.WaitOn(t, container.IsSuccessful(ctx, client, c), poll.WithDelay(100*time.Millisecond))
269
+		poll.WaitOn(t, container.IsSuccessful(ctx, apiClient, c), poll.WithDelay(100*time.Millisecond))
270 270
 	}
271 271
 }
272 272
 
... ...
@@ -311,9 +311,9 @@ func TestContainerVolumesMountedAsShared(t *testing.T) {
311 311
 	bindMountCmd := []string{"mount", "--bind", "/volume-dest/mnt1", "/volume-dest/mnt1"}
312 312
 
313 313
 	ctx := context.Background()
314
-	client := testEnv.APIClient()
315
-	containerID := container.Run(ctx, t, client, container.WithPrivileged(true), container.WithMount(sharedMount), container.WithCmd(bindMountCmd...))
316
-	poll.WaitOn(t, container.IsSuccessful(ctx, client, containerID), poll.WithDelay(100*time.Millisecond))
314
+	apiClient := testEnv.APIClient()
315
+	containerID := container.Run(ctx, t, apiClient, container.WithPrivileged(true), container.WithMount(sharedMount), container.WithCmd(bindMountCmd...))
316
+	poll.WaitOn(t, container.IsSuccessful(ctx, apiClient, containerID), poll.WithDelay(100*time.Millisecond))
317 317
 
318 318
 	// Make sure a bind mount under a shared volume propagated to host.
319 319
 	if mounted, _ := mountinfo.Mounted(tmpDir1Mnt); !mounted {
... ...
@@ -368,8 +368,8 @@ func TestContainerVolumesMountedAsSlave(t *testing.T) {
368 368
 	topCmd := []string{"top"}
369 369
 
370 370
 	ctx := context.Background()
371
-	client := testEnv.APIClient()
372
-	containerID := container.Run(ctx, t, client, container.WithTty(true), container.WithMount(slaveMount), container.WithCmd(topCmd...))
371
+	apiClient := testEnv.APIClient()
372
+	containerID := container.Run(ctx, t, apiClient, container.WithTty(true), container.WithMount(slaveMount), container.WithCmd(topCmd...))
373 373
 
374 374
 	// Bind mount tmpDir2/ onto tmpDir1/mnt1. If mount propagates inside
375 375
 	// container then contents of tmpDir2/slave-testfile should become
... ...
@@ -385,7 +385,7 @@ func TestContainerVolumesMountedAsSlave(t *testing.T) {
385 385
 
386 386
 	mountCmd := []string{"cat", "/volume-dest/mnt1/slave-testfile"}
387 387
 
388
-	if result, err := container.Exec(ctx, client, containerID, mountCmd); err == nil {
388
+	if result, err := container.Exec(ctx, apiClient, containerID, mountCmd); err == nil {
389 389
 		if result.Stdout() != "Test" {
390 390
 			t.Fatalf("Bind mount under slave volume did not propagate to container")
391 391
 		}
... ...
@@ -408,12 +408,12 @@ func TestContainerCopyLeaksMounts(t *testing.T) {
408 408
 	}
409 409
 
410 410
 	ctx := context.Background()
411
-	client := testEnv.APIClient()
412
-	cid := container.Run(ctx, t, client, container.WithMount(bindMount), container.WithCmd("sleep", "120s"))
411
+	apiClient := testEnv.APIClient()
412
+	cid := container.Run(ctx, t, apiClient, container.WithMount(bindMount), container.WithCmd("sleep", "120s"))
413 413
 
414 414
 	getMounts := func() string {
415 415
 		t.Helper()
416
-		res, err := container.Exec(ctx, client, cid, []string{"cat", "/proc/self/mountinfo"})
416
+		res, err := container.Exec(ctx, apiClient, cid, []string{"cat", "/proc/self/mountinfo"})
417 417
 		assert.NilError(t, err)
418 418
 		assert.Equal(t, res.ExitCode, 0)
419 419
 		return res.Stdout()
... ...
@@ -421,7 +421,7 @@ func TestContainerCopyLeaksMounts(t *testing.T) {
421 421
 
422 422
 	mountsBefore := getMounts()
423 423
 
424
-	_, _, err := client.CopyFromContainer(ctx, cid, "/etc/passwd")
424
+	_, _, err := apiClient.CopyFromContainer(ctx, cid, "/etc/passwd")
425 425
 	assert.NilError(t, err)
426 426
 
427 427
 	mountsAfter := getMounts()
... ...
@@ -489,22 +489,22 @@ func TestContainerBindMountRecursivelyReadOnly(t *testing.T) {
489 489
 	}
490 490
 
491 491
 	ctx := context.Background()
492
-	client := testEnv.APIClient()
492
+	apiClient := testEnv.APIClient()
493 493
 
494 494
 	containers := []string{
495
-		container.Run(ctx, t, client, container.WithMount(ro), container.WithCmd(roVerifier...)),
496
-		container.Run(ctx, t, client, container.WithBindRaw(roAsStr), container.WithCmd(roVerifier...)),
495
+		container.Run(ctx, t, apiClient, container.WithMount(ro), container.WithCmd(roVerifier...)),
496
+		container.Run(ctx, t, apiClient, container.WithBindRaw(roAsStr), container.WithCmd(roVerifier...)),
497 497
 
498
-		container.Run(ctx, t, client, container.WithMount(nonRecursive), container.WithCmd(nonRecursiveVerifier...)),
498
+		container.Run(ctx, t, apiClient, container.WithMount(nonRecursive), container.WithCmd(nonRecursiveVerifier...)),
499 499
 	}
500 500
 
501 501
 	if rroSupported {
502 502
 		containers = append(containers,
503
-			container.Run(ctx, t, client, container.WithMount(forceRecursive), container.WithCmd(forceRecursiveVerifier...)),
503
+			container.Run(ctx, t, apiClient, container.WithMount(forceRecursive), container.WithCmd(forceRecursiveVerifier...)),
504 504
 		)
505 505
 	}
506 506
 
507 507
 	for _, c := range containers {
508
-		poll.WaitOn(t, container.IsSuccessful(ctx, client, c), poll.WithDelay(100*time.Millisecond))
508
+		poll.WaitOn(t, container.IsSuccessful(ctx, apiClient, c), poll.WithDelay(100*time.Millisecond))
509 509
 	}
510 510
 }
... ...
@@ -67,18 +67,18 @@ func TestNetworkLoopbackNat(t *testing.T) {
67 67
 
68 68
 	endpoint := getExternalAddress(t)
69 69
 
70
-	client := testEnv.APIClient()
70
+	apiClient := testEnv.APIClient()
71 71
 	ctx := context.Background()
72 72
 
73
-	cID := container.Run(ctx, t, client,
73
+	cID := container.Run(ctx, t, apiClient,
74 74
 		container.WithCmd("sh", "-c", fmt.Sprintf("stty raw && nc -w 1 %s 8080", endpoint.String())),
75 75
 		container.WithTty(true),
76 76
 		container.WithNetworkMode("container:"+serverContainerID),
77 77
 	)
78 78
 
79
-	poll.WaitOn(t, container.IsStopped(ctx, client, cID), poll.WithDelay(100*time.Millisecond))
79
+	poll.WaitOn(t, container.IsStopped(ctx, apiClient, cID), poll.WithDelay(100*time.Millisecond))
80 80
 
81
-	body, err := client.ContainerLogs(ctx, cID, types.ContainerLogsOptions{
81
+	body, err := apiClient.ContainerLogs(ctx, cID, types.ContainerLogsOptions{
82 82
 		ShowStdout: true,
83 83
 	})
84 84
 	assert.NilError(t, err)
... ...
@@ -93,10 +93,10 @@ func TestNetworkLoopbackNat(t *testing.T) {
93 93
 
94 94
 func startServerContainer(t *testing.T, msg string, port int) string {
95 95
 	t.Helper()
96
-	client := testEnv.APIClient()
96
+	apiClient := testEnv.APIClient()
97 97
 	ctx := context.Background()
98 98
 
99
-	cID := container.Run(ctx, t, client,
99
+	cID := container.Run(ctx, t, apiClient,
100 100
 		container.WithName("server-"+t.Name()),
101 101
 		container.WithCmd("sh", "-c", fmt.Sprintf("echo %q | nc -lp %d", msg, port)),
102 102
 		container.WithExposedPorts(fmt.Sprintf("%d/tcp", port)),
... ...
@@ -110,7 +110,7 @@ func startServerContainer(t *testing.T, msg string, port int) string {
110 110
 			}
111 111
 		})
112 112
 
113
-	poll.WaitOn(t, container.IsInState(ctx, client, cID, "running"), poll.WithDelay(100*time.Millisecond))
113
+	poll.WaitOn(t, container.IsInState(ctx, apiClient, cID, "running"), poll.WithDelay(100*time.Millisecond))
114 114
 
115 115
 	return cID
116 116
 }
... ...
@@ -25,27 +25,27 @@ func TestPause(t *testing.T) {
25 25
 	skip.If(t, testEnv.DaemonInfo.CgroupDriver == "none")
26 26
 
27 27
 	defer setupTest(t)()
28
-	client := testEnv.APIClient()
28
+	apiClient := testEnv.APIClient()
29 29
 	ctx := context.Background()
30 30
 
31
-	cID := container.Run(ctx, t, client)
32
-	poll.WaitOn(t, container.IsInState(ctx, client, cID, "running"), poll.WithDelay(100*time.Millisecond))
31
+	cID := container.Run(ctx, t, apiClient)
32
+	poll.WaitOn(t, container.IsInState(ctx, apiClient, cID, "running"), poll.WithDelay(100*time.Millisecond))
33 33
 
34
-	since := request.DaemonUnixTime(ctx, t, client, testEnv)
34
+	since := request.DaemonUnixTime(ctx, t, apiClient, testEnv)
35 35
 
36
-	err := client.ContainerPause(ctx, cID)
36
+	err := apiClient.ContainerPause(ctx, cID)
37 37
 	assert.NilError(t, err)
38 38
 
39
-	inspect, err := client.ContainerInspect(ctx, cID)
39
+	inspect, err := apiClient.ContainerInspect(ctx, cID)
40 40
 	assert.NilError(t, err)
41 41
 	assert.Check(t, is.Equal(true, inspect.State.Paused))
42 42
 
43
-	err = client.ContainerUnpause(ctx, cID)
43
+	err = apiClient.ContainerUnpause(ctx, cID)
44 44
 	assert.NilError(t, err)
45 45
 
46
-	until := request.DaemonUnixTime(ctx, t, client, testEnv)
46
+	until := request.DaemonUnixTime(ctx, t, apiClient, testEnv)
47 47
 
48
-	messages, errs := client.Events(ctx, types.EventsOptions{
48
+	messages, errs := apiClient.Events(ctx, types.EventsOptions{
49 49
 		Since:   since,
50 50
 		Until:   until,
51 51
 		Filters: filters.NewArgs(filters.Arg("container", cID)),
... ...
@@ -57,13 +57,13 @@ func TestPauseFailsOnWindowsServerContainers(t *testing.T) {
57 57
 	skip.If(t, testEnv.DaemonInfo.OSType != "windows" || testEnv.DaemonInfo.Isolation != "process")
58 58
 
59 59
 	defer setupTest(t)()
60
-	client := testEnv.APIClient()
60
+	apiClient := testEnv.APIClient()
61 61
 	ctx := context.Background()
62 62
 
63
-	cID := container.Run(ctx, t, client)
64
-	poll.WaitOn(t, container.IsInState(ctx, client, cID, "running"), poll.WithDelay(100*time.Millisecond))
63
+	cID := container.Run(ctx, t, apiClient)
64
+	poll.WaitOn(t, container.IsInState(ctx, apiClient, cID, "running"), poll.WithDelay(100*time.Millisecond))
65 65
 
66
-	err := client.ContainerPause(ctx, cID)
66
+	err := apiClient.ContainerPause(ctx, cID)
67 67
 	assert.Check(t, is.ErrorContains(err, cerrdefs.ErrNotImplemented.Error()))
68 68
 }
69 69
 
... ...
@@ -72,19 +72,19 @@ func TestPauseStopPausedContainer(t *testing.T) {
72 72
 	skip.If(t, versions.LessThan(testEnv.DaemonAPIVersion(), "1.31"), "broken in earlier versions")
73 73
 	skip.If(t, testEnv.DaemonInfo.CgroupDriver == "none")
74 74
 	defer setupTest(t)()
75
-	client := testEnv.APIClient()
75
+	apiClient := testEnv.APIClient()
76 76
 	ctx := context.Background()
77 77
 
78
-	cID := container.Run(ctx, t, client)
79
-	poll.WaitOn(t, container.IsInState(ctx, client, cID, "running"), poll.WithDelay(100*time.Millisecond))
78
+	cID := container.Run(ctx, t, apiClient)
79
+	poll.WaitOn(t, container.IsInState(ctx, apiClient, cID, "running"), poll.WithDelay(100*time.Millisecond))
80 80
 
81
-	err := client.ContainerPause(ctx, cID)
81
+	err := apiClient.ContainerPause(ctx, cID)
82 82
 	assert.NilError(t, err)
83 83
 
84
-	err = client.ContainerStop(ctx, cID, containertypes.StopOptions{})
84
+	err = apiClient.ContainerStop(ctx, cID, containertypes.StopOptions{})
85 85
 	assert.NilError(t, err)
86 86
 
87
-	poll.WaitOn(t, container.IsStopped(ctx, client, cID), poll.WithDelay(100*time.Millisecond))
87
+	poll.WaitOn(t, container.IsStopped(ctx, apiClient, cID), poll.WithDelay(100*time.Millisecond))
88 88
 }
89 89
 
90 90
 func getEventActions(t *testing.T, messages <-chan events.Message, errs <-chan error) []string {
... ...
@@ -20,18 +20,18 @@ func TestPidHost(t *testing.T) {
20 20
 	assert.NilError(t, err)
21 21
 
22 22
 	defer setupTest(t)()
23
-	client := testEnv.APIClient()
23
+	apiClient := testEnv.APIClient()
24 24
 	ctx := context.Background()
25 25
 
26
-	cID := container.Run(ctx, t, client, func(c *container.TestContainerConfig) {
26
+	cID := container.Run(ctx, t, apiClient, func(c *container.TestContainerConfig) {
27 27
 		c.HostConfig.PidMode = "host"
28 28
 	})
29
-	poll.WaitOn(t, container.IsInState(ctx, client, cID, "running"), poll.WithDelay(100*time.Millisecond))
30
-	cPid := container.GetContainerNS(ctx, t, client, cID, "pid")
29
+	poll.WaitOn(t, container.IsInState(ctx, apiClient, cID, "running"), poll.WithDelay(100*time.Millisecond))
30
+	cPid := container.GetContainerNS(ctx, t, apiClient, cID, "pid")
31 31
 	assert.Assert(t, hostPid == cPid)
32 32
 
33
-	cID = container.Run(ctx, t, client)
34
-	poll.WaitOn(t, container.IsInState(ctx, client, cID, "running"), poll.WithDelay(100*time.Millisecond))
35
-	cPid = container.GetContainerNS(ctx, t, client, cID, "pid")
33
+	cID = container.Run(ctx, t, apiClient)
34
+	poll.WaitOn(t, container.IsInState(ctx, apiClient, cID, "running"), poll.WithDelay(100*time.Millisecond))
35
+	cPid = container.GetContainerNS(ctx, t, apiClient, cID, "pid")
36 36
 	assert.Assert(t, hostPid != cPid)
37 37
 }
... ...
@@ -13,12 +13,12 @@ import (
13 13
 
14 14
 func TestPsFilter(t *testing.T) {
15 15
 	defer setupTest(t)()
16
-	client := testEnv.APIClient()
16
+	apiClient := testEnv.APIClient()
17 17
 	ctx := context.Background()
18 18
 
19
-	prev := container.Create(ctx, t, client)
20
-	top := container.Create(ctx, t, client)
21
-	next := container.Create(ctx, t, client)
19
+	prev := container.Create(ctx, t, apiClient)
20
+	top := container.Create(ctx, t, apiClient)
21
+	next := container.Create(ctx, t, apiClient)
22 22
 
23 23
 	containerIDs := func(containers []types.Container) []string {
24 24
 		var entries []string
... ...
@@ -29,7 +29,7 @@ func TestPsFilter(t *testing.T) {
29 29
 	}
30 30
 
31 31
 	t.Run("since", func(t *testing.T) {
32
-		results, err := client.ContainerList(ctx, types.ContainerListOptions{
32
+		results, err := apiClient.ContainerList(ctx, types.ContainerListOptions{
33 33
 			All:     true,
34 34
 			Filters: filters.NewArgs(filters.Arg("since", top)),
35 35
 		})
... ...
@@ -38,7 +38,7 @@ func TestPsFilter(t *testing.T) {
38 38
 	})
39 39
 
40 40
 	t.Run("before", func(t *testing.T) {
41
-		results, err := client.ContainerList(ctx, types.ContainerListOptions{
41
+		results, err := apiClient.ContainerList(ctx, types.ContainerListOptions{
42 42
 			All:     true,
43 43
 			Filters: filters.NewArgs(filters.Arg("before", top)),
44 44
 		})
... ...
@@ -30,25 +30,25 @@ func TestRemoveContainerWithRemovedVolume(t *testing.T) {
30 30
 
31 31
 	defer setupTest(t)()
32 32
 	ctx := context.Background()
33
-	client := testEnv.APIClient()
33
+	apiClient := testEnv.APIClient()
34 34
 
35 35
 	prefix, slash := getPrefixAndSlashFromDaemonPlatform()
36 36
 
37 37
 	tempDir := fs.NewDir(t, "test-rm-container-with-removed-volume", fs.WithMode(0o755))
38 38
 	defer tempDir.Remove()
39 39
 
40
-	cID := container.Run(ctx, t, client, container.WithCmd("true"), container.WithBind(tempDir.Path(), prefix+slash+"test"))
41
-	poll.WaitOn(t, container.IsInState(ctx, client, cID, "exited"), poll.WithDelay(100*time.Millisecond))
40
+	cID := container.Run(ctx, t, apiClient, container.WithCmd("true"), container.WithBind(tempDir.Path(), prefix+slash+"test"))
41
+	poll.WaitOn(t, container.IsInState(ctx, apiClient, cID, "exited"), poll.WithDelay(100*time.Millisecond))
42 42
 
43 43
 	err := os.RemoveAll(tempDir.Path())
44 44
 	assert.NilError(t, err)
45 45
 
46
-	err = client.ContainerRemove(ctx, cID, types.ContainerRemoveOptions{
46
+	err = apiClient.ContainerRemove(ctx, cID, types.ContainerRemoveOptions{
47 47
 		RemoveVolumes: true,
48 48
 	})
49 49
 	assert.NilError(t, err)
50 50
 
51
-	_, _, err = client.ContainerInspectWithRaw(ctx, cID, true)
51
+	_, _, err = apiClient.ContainerInspectWithRaw(ctx, cID, true)
52 52
 	assert.Check(t, is.ErrorContains(err, "No such container"))
53 53
 }
54 54
 
... ...
@@ -56,24 +56,24 @@ func TestRemoveContainerWithRemovedVolume(t *testing.T) {
56 56
 func TestRemoveContainerWithVolume(t *testing.T) {
57 57
 	defer setupTest(t)()
58 58
 	ctx := context.Background()
59
-	client := testEnv.APIClient()
59
+	apiClient := testEnv.APIClient()
60 60
 
61 61
 	prefix, slash := getPrefixAndSlashFromDaemonPlatform()
62 62
 
63
-	cID := container.Run(ctx, t, client, container.WithCmd("true"), container.WithVolume(prefix+slash+"srv"))
64
-	poll.WaitOn(t, container.IsInState(ctx, client, cID, "exited"), poll.WithDelay(100*time.Millisecond))
63
+	cID := container.Run(ctx, t, apiClient, container.WithCmd("true"), container.WithVolume(prefix+slash+"srv"))
64
+	poll.WaitOn(t, container.IsInState(ctx, apiClient, cID, "exited"), poll.WithDelay(100*time.Millisecond))
65 65
 
66
-	insp, _, err := client.ContainerInspectWithRaw(ctx, cID, true)
66
+	insp, _, err := apiClient.ContainerInspectWithRaw(ctx, cID, true)
67 67
 	assert.NilError(t, err)
68 68
 	assert.Check(t, is.Equal(1, len(insp.Mounts)))
69 69
 	volName := insp.Mounts[0].Name
70 70
 
71
-	err = client.ContainerRemove(ctx, cID, types.ContainerRemoveOptions{
71
+	err = apiClient.ContainerRemove(ctx, cID, types.ContainerRemoveOptions{
72 72
 		RemoveVolumes: true,
73 73
 	})
74 74
 	assert.NilError(t, err)
75 75
 
76
-	volumes, err := client.VolumeList(ctx, volume.ListOptions{
76
+	volumes, err := apiClient.VolumeList(ctx, volume.ListOptions{
77 77
 		Filters: filters.NewArgs(filters.Arg("name", volName)),
78 78
 	})
79 79
 	assert.NilError(t, err)
... ...
@@ -83,22 +83,22 @@ func TestRemoveContainerWithVolume(t *testing.T) {
83 83
 func TestRemoveContainerRunning(t *testing.T) {
84 84
 	defer setupTest(t)()
85 85
 	ctx := context.Background()
86
-	client := testEnv.APIClient()
86
+	apiClient := testEnv.APIClient()
87 87
 
88
-	cID := container.Run(ctx, t, client)
88
+	cID := container.Run(ctx, t, apiClient)
89 89
 
90
-	err := client.ContainerRemove(ctx, cID, types.ContainerRemoveOptions{})
90
+	err := apiClient.ContainerRemove(ctx, cID, types.ContainerRemoveOptions{})
91 91
 	assert.Check(t, is.ErrorContains(err, "cannot remove a running container"))
92 92
 }
93 93
 
94 94
 func TestRemoveContainerForceRemoveRunning(t *testing.T) {
95 95
 	defer setupTest(t)()
96 96
 	ctx := context.Background()
97
-	client := testEnv.APIClient()
97
+	apiClient := testEnv.APIClient()
98 98
 
99
-	cID := container.Run(ctx, t, client)
99
+	cID := container.Run(ctx, t, apiClient)
100 100
 
101
-	err := client.ContainerRemove(ctx, cID, types.ContainerRemoveOptions{
101
+	err := apiClient.ContainerRemove(ctx, cID, types.ContainerRemoveOptions{
102 102
 		Force: true,
103 103
 	})
104 104
 	assert.NilError(t, err)
... ...
@@ -107,8 +107,8 @@ func TestRemoveContainerForceRemoveRunning(t *testing.T) {
107 107
 func TestRemoveInvalidContainer(t *testing.T) {
108 108
 	defer setupTest(t)()
109 109
 	ctx := context.Background()
110
-	client := testEnv.APIClient()
110
+	apiClient := testEnv.APIClient()
111 111
 
112
-	err := client.ContainerRemove(ctx, "unknown", types.ContainerRemoveOptions{})
112
+	err := apiClient.ContainerRemove(ctx, "unknown", types.ContainerRemoveOptions{})
113 113
 	assert.Check(t, is.ErrorContains(err, "No such container"))
114 114
 }
... ...
@@ -26,24 +26,24 @@ func TestRenameLinkedContainer(t *testing.T) {
26 26
 	skip.If(t, testEnv.DaemonInfo.OSType == "windows", "FIXME")
27 27
 	defer setupTest(t)()
28 28
 	ctx := context.Background()
29
-	client := testEnv.APIClient()
29
+	apiClient := testEnv.APIClient()
30 30
 
31 31
 	aName := "a0" + t.Name()
32 32
 	bName := "b0" + t.Name()
33
-	aID := container.Run(ctx, t, client, container.WithName(aName))
34
-	bID := container.Run(ctx, t, client, container.WithName(bName), container.WithLinks(aName))
33
+	aID := container.Run(ctx, t, apiClient, container.WithName(aName))
34
+	bID := container.Run(ctx, t, apiClient, container.WithName(bName), container.WithLinks(aName))
35 35
 
36
-	err := client.ContainerRename(ctx, aID, "a1"+t.Name())
36
+	err := apiClient.ContainerRename(ctx, aID, "a1"+t.Name())
37 37
 	assert.NilError(t, err)
38 38
 
39
-	container.Run(ctx, t, client, container.WithName(aName))
39
+	container.Run(ctx, t, apiClient, container.WithName(aName))
40 40
 
41
-	err = client.ContainerRemove(ctx, bID, types.ContainerRemoveOptions{Force: true})
41
+	err = apiClient.ContainerRemove(ctx, bID, types.ContainerRemoveOptions{Force: true})
42 42
 	assert.NilError(t, err)
43 43
 
44
-	bID = container.Run(ctx, t, client, container.WithName(bName), container.WithLinks(aName))
44
+	bID = container.Run(ctx, t, apiClient, container.WithName(bName), container.WithLinks(aName))
45 45
 
46
-	inspect, err := client.ContainerInspect(ctx, bID)
46
+	inspect, err := apiClient.ContainerInspect(ctx, bID)
47 47
 	assert.NilError(t, err)
48 48
 	assert.Check(t, is.DeepEqual([]string{"/" + aName + ":/" + bName + "/" + aName}, inspect.HostConfig.Links))
49 49
 }
... ...
@@ -51,21 +51,21 @@ func TestRenameLinkedContainer(t *testing.T) {
51 51
 func TestRenameStoppedContainer(t *testing.T) {
52 52
 	defer setupTest(t)()
53 53
 	ctx := context.Background()
54
-	client := testEnv.APIClient()
54
+	apiClient := testEnv.APIClient()
55 55
 
56 56
 	oldName := "first_name" + t.Name()
57
-	cID := container.Run(ctx, t, client, container.WithName(oldName), container.WithCmd("sh"))
58
-	poll.WaitOn(t, container.IsInState(ctx, client, cID, "exited"), poll.WithDelay(100*time.Millisecond))
57
+	cID := container.Run(ctx, t, apiClient, container.WithName(oldName), container.WithCmd("sh"))
58
+	poll.WaitOn(t, container.IsInState(ctx, apiClient, cID, "exited"), poll.WithDelay(100*time.Millisecond))
59 59
 
60
-	inspect, err := client.ContainerInspect(ctx, cID)
60
+	inspect, err := apiClient.ContainerInspect(ctx, cID)
61 61
 	assert.NilError(t, err)
62 62
 	assert.Check(t, is.Equal("/"+oldName, inspect.Name))
63 63
 
64 64
 	newName := "new_name" + stringid.GenerateRandomID()
65
-	err = client.ContainerRename(ctx, oldName, newName)
65
+	err = apiClient.ContainerRename(ctx, oldName, newName)
66 66
 	assert.NilError(t, err)
67 67
 
68
-	inspect, err = client.ContainerInspect(ctx, cID)
68
+	inspect, err = apiClient.ContainerInspect(ctx, cID)
69 69
 	assert.NilError(t, err)
70 70
 	assert.Check(t, is.Equal("/"+newName, inspect.Name))
71 71
 }
... ...
@@ -73,27 +73,27 @@ func TestRenameStoppedContainer(t *testing.T) {
73 73
 func TestRenameRunningContainerAndReuse(t *testing.T) {
74 74
 	defer setupTest(t)()
75 75
 	ctx := context.Background()
76
-	client := testEnv.APIClient()
76
+	apiClient := testEnv.APIClient()
77 77
 
78 78
 	oldName := "first_name" + t.Name()
79
-	cID := container.Run(ctx, t, client, container.WithName(oldName))
80
-	poll.WaitOn(t, container.IsInState(ctx, client, cID, "running"), poll.WithDelay(100*time.Millisecond))
79
+	cID := container.Run(ctx, t, apiClient, container.WithName(oldName))
80
+	poll.WaitOn(t, container.IsInState(ctx, apiClient, cID, "running"), poll.WithDelay(100*time.Millisecond))
81 81
 
82 82
 	newName := "new_name" + stringid.GenerateRandomID()
83
-	err := client.ContainerRename(ctx, oldName, newName)
83
+	err := apiClient.ContainerRename(ctx, oldName, newName)
84 84
 	assert.NilError(t, err)
85 85
 
86
-	inspect, err := client.ContainerInspect(ctx, cID)
86
+	inspect, err := apiClient.ContainerInspect(ctx, cID)
87 87
 	assert.NilError(t, err)
88 88
 	assert.Check(t, is.Equal("/"+newName, inspect.Name))
89 89
 
90
-	_, err = client.ContainerInspect(ctx, oldName)
90
+	_, err = apiClient.ContainerInspect(ctx, oldName)
91 91
 	assert.Check(t, is.ErrorContains(err, "No such container: "+oldName))
92 92
 
93
-	cID = container.Run(ctx, t, client, container.WithName(oldName))
94
-	poll.WaitOn(t, container.IsInState(ctx, client, cID, "running"), poll.WithDelay(100*time.Millisecond))
93
+	cID = container.Run(ctx, t, apiClient, container.WithName(oldName))
94
+	poll.WaitOn(t, container.IsInState(ctx, apiClient, cID, "running"), poll.WithDelay(100*time.Millisecond))
95 95
 
96
-	inspect, err = client.ContainerInspect(ctx, cID)
96
+	inspect, err = apiClient.ContainerInspect(ctx, cID)
97 97
 	assert.NilError(t, err)
98 98
 	assert.Check(t, is.Equal("/"+oldName, inspect.Name))
99 99
 }
... ...
@@ -101,16 +101,16 @@ func TestRenameRunningContainerAndReuse(t *testing.T) {
101 101
 func TestRenameInvalidName(t *testing.T) {
102 102
 	defer setupTest(t)()
103 103
 	ctx := context.Background()
104
-	client := testEnv.APIClient()
104
+	apiClient := testEnv.APIClient()
105 105
 
106 106
 	oldName := "first_name" + t.Name()
107
-	cID := container.Run(ctx, t, client, container.WithName(oldName))
108
-	poll.WaitOn(t, container.IsInState(ctx, client, cID, "running"), poll.WithDelay(100*time.Millisecond))
107
+	cID := container.Run(ctx, t, apiClient, container.WithName(oldName))
108
+	poll.WaitOn(t, container.IsInState(ctx, apiClient, cID, "running"), poll.WithDelay(100*time.Millisecond))
109 109
 
110
-	err := client.ContainerRename(ctx, oldName, "new:invalid")
110
+	err := apiClient.ContainerRename(ctx, oldName, "new:invalid")
111 111
 	assert.Check(t, is.ErrorContains(err, "Invalid container name"))
112 112
 
113
-	inspect, err := client.ContainerInspect(ctx, oldName)
113
+	inspect, err := apiClient.ContainerInspect(ctx, oldName)
114 114
 	assert.NilError(t, err)
115 115
 	assert.Check(t, is.Equal(cID, inspect.ID))
116 116
 }
... ...
@@ -125,13 +125,13 @@ func TestRenameInvalidName(t *testing.T) {
125 125
 func TestRenameAnonymousContainer(t *testing.T) {
126 126
 	defer setupTest(t)()
127 127
 	ctx := context.Background()
128
-	client := testEnv.APIClient()
128
+	apiClient := testEnv.APIClient()
129 129
 
130 130
 	networkName := "network1" + t.Name()
131
-	_, err := client.NetworkCreate(ctx, networkName, types.NetworkCreate{})
131
+	_, err := apiClient.NetworkCreate(ctx, networkName, types.NetworkCreate{})
132 132
 
133 133
 	assert.NilError(t, err)
134
-	cID := container.Run(ctx, t, client, func(c *container.TestContainerConfig) {
134
+	cID := container.Run(ctx, t, apiClient, func(c *container.TestContainerConfig) {
135 135
 		c.NetworkingConfig.EndpointsConfig = map[string]*network.EndpointSettings{
136 136
 			networkName: {},
137 137
 		}
... ...
@@ -139,30 +139,30 @@ func TestRenameAnonymousContainer(t *testing.T) {
139 139
 	})
140 140
 
141 141
 	container1Name := "container1" + t.Name()
142
-	err = client.ContainerRename(ctx, cID, container1Name)
142
+	err = apiClient.ContainerRename(ctx, cID, container1Name)
143 143
 	assert.NilError(t, err)
144 144
 	// Stop/Start the container to get registered
145 145
 	// FIXME(vdemeester) this is a really weird behavior as it fails otherwise
146
-	err = client.ContainerStop(ctx, container1Name, containertypes.StopOptions{})
146
+	err = apiClient.ContainerStop(ctx, container1Name, containertypes.StopOptions{})
147 147
 	assert.NilError(t, err)
148
-	err = client.ContainerStart(ctx, container1Name, types.ContainerStartOptions{})
148
+	err = apiClient.ContainerStart(ctx, container1Name, types.ContainerStartOptions{})
149 149
 	assert.NilError(t, err)
150 150
 
151
-	poll.WaitOn(t, container.IsInState(ctx, client, cID, "running"), poll.WithDelay(100*time.Millisecond))
151
+	poll.WaitOn(t, container.IsInState(ctx, apiClient, cID, "running"), poll.WithDelay(100*time.Millisecond))
152 152
 
153 153
 	count := "-c"
154 154
 	if testEnv.DaemonInfo.OSType == "windows" {
155 155
 		count = "-n"
156 156
 	}
157
-	cID = container.Run(ctx, t, client, func(c *container.TestContainerConfig) {
157
+	cID = container.Run(ctx, t, apiClient, func(c *container.TestContainerConfig) {
158 158
 		c.NetworkingConfig.EndpointsConfig = map[string]*network.EndpointSettings{
159 159
 			networkName: {},
160 160
 		}
161 161
 		c.HostConfig.NetworkMode = containertypes.NetworkMode(networkName)
162 162
 	}, container.WithCmd("ping", count, "1", container1Name))
163
-	poll.WaitOn(t, container.IsInState(ctx, client, cID, "exited"), poll.WithDelay(100*time.Millisecond))
163
+	poll.WaitOn(t, container.IsInState(ctx, apiClient, cID, "exited"), poll.WithDelay(100*time.Millisecond))
164 164
 
165
-	inspect, err := client.ContainerInspect(ctx, cID)
165
+	inspect, err := apiClient.ContainerInspect(ctx, cID)
166 166
 	assert.NilError(t, err)
167 167
 	assert.Check(t, is.Equal(0, inspect.State.ExitCode), "container %s exited with the wrong exitcode: %s", cID, inspect.State.Error)
168 168
 }
... ...
@@ -171,15 +171,15 @@ func TestRenameAnonymousContainer(t *testing.T) {
171 171
 func TestRenameContainerWithSameName(t *testing.T) {
172 172
 	defer setupTest(t)()
173 173
 	ctx := context.Background()
174
-	client := testEnv.APIClient()
174
+	apiClient := testEnv.APIClient()
175 175
 
176 176
 	oldName := "old" + t.Name()
177
-	cID := container.Run(ctx, t, client, container.WithName(oldName))
177
+	cID := container.Run(ctx, t, apiClient, container.WithName(oldName))
178 178
 
179
-	poll.WaitOn(t, container.IsInState(ctx, client, cID, "running"), poll.WithDelay(100*time.Millisecond))
180
-	err := client.ContainerRename(ctx, oldName, oldName)
179
+	poll.WaitOn(t, container.IsInState(ctx, apiClient, cID, "running"), poll.WithDelay(100*time.Millisecond))
180
+	err := apiClient.ContainerRename(ctx, oldName, oldName)
181 181
 	assert.Check(t, is.ErrorContains(err, "Renaming a container with the same name"))
182
-	err = client.ContainerRename(ctx, cID, oldName)
182
+	err = apiClient.ContainerRename(ctx, cID, oldName)
183 183
 	assert.Check(t, is.ErrorContains(err, "Renaming a container with the same name"))
184 184
 }
185 185
 
... ...
@@ -194,21 +194,21 @@ func TestRenameContainerWithLinkedContainer(t *testing.T) {
194 194
 
195 195
 	defer setupTest(t)()
196 196
 	ctx := context.Background()
197
-	client := testEnv.APIClient()
197
+	apiClient := testEnv.APIClient()
198 198
 
199 199
 	db1Name := "db1" + t.Name()
200
-	db1ID := container.Run(ctx, t, client, container.WithName(db1Name))
201
-	poll.WaitOn(t, container.IsInState(ctx, client, db1ID, "running"), poll.WithDelay(100*time.Millisecond))
200
+	db1ID := container.Run(ctx, t, apiClient, container.WithName(db1Name))
201
+	poll.WaitOn(t, container.IsInState(ctx, apiClient, db1ID, "running"), poll.WithDelay(100*time.Millisecond))
202 202
 
203 203
 	app1Name := "app1" + t.Name()
204 204
 	app2Name := "app2" + t.Name()
205
-	app1ID := container.Run(ctx, t, client, container.WithName(app1Name), container.WithLinks(db1Name+":/mysql"))
206
-	poll.WaitOn(t, container.IsInState(ctx, client, app1ID, "running"), poll.WithDelay(100*time.Millisecond))
205
+	app1ID := container.Run(ctx, t, apiClient, container.WithName(app1Name), container.WithLinks(db1Name+":/mysql"))
206
+	poll.WaitOn(t, container.IsInState(ctx, apiClient, app1ID, "running"), poll.WithDelay(100*time.Millisecond))
207 207
 
208
-	err := client.ContainerRename(ctx, app1Name, app2Name)
208
+	err := apiClient.ContainerRename(ctx, app1Name, app2Name)
209 209
 	assert.NilError(t, err)
210 210
 
211
-	inspect, err := client.ContainerInspect(ctx, app2Name+"/mysql")
211
+	inspect, err := apiClient.ContainerInspect(ctx, app2Name+"/mysql")
212 212
 	assert.NilError(t, err)
213 213
 	assert.Check(t, is.Equal(db1ID, inspect.ID))
214 214
 }
... ...
@@ -18,14 +18,14 @@ import (
18 18
 
19 19
 func TestResize(t *testing.T) {
20 20
 	defer setupTest(t)()
21
-	client := testEnv.APIClient()
21
+	apiClient := testEnv.APIClient()
22 22
 	ctx := context.Background()
23 23
 
24
-	cID := container.Run(ctx, t, client, container.WithTty(true))
24
+	cID := container.Run(ctx, t, apiClient, container.WithTty(true))
25 25
 
26
-	poll.WaitOn(t, container.IsInState(ctx, client, cID, "running"), poll.WithDelay(100*time.Millisecond))
26
+	poll.WaitOn(t, container.IsInState(ctx, apiClient, cID, "running"), poll.WithDelay(100*time.Millisecond))
27 27
 
28
-	err := client.ContainerResize(ctx, cID, types.ResizeOptions{
28
+	err := apiClient.ContainerResize(ctx, cID, types.ResizeOptions{
29 29
 		Height: 40,
30 30
 		Width:  40,
31 31
 	})
... ...
@@ -35,12 +35,12 @@ func TestResize(t *testing.T) {
35 35
 func TestResizeWithInvalidSize(t *testing.T) {
36 36
 	skip.If(t, versions.LessThan(testEnv.DaemonAPIVersion(), "1.32"), "broken in earlier versions")
37 37
 	defer setupTest(t)()
38
-	client := testEnv.APIClient()
38
+	apiClient := testEnv.APIClient()
39 39
 	ctx := context.Background()
40 40
 
41
-	cID := container.Run(ctx, t, client)
41
+	cID := container.Run(ctx, t, apiClient)
42 42
 
43
-	poll.WaitOn(t, container.IsInState(ctx, client, cID, "running"), poll.WithDelay(100*time.Millisecond))
43
+	poll.WaitOn(t, container.IsInState(ctx, apiClient, cID, "running"), poll.WithDelay(100*time.Millisecond))
44 44
 
45 45
 	endpoint := "/containers/" + cID + "/resize?h=foo&w=bar"
46 46
 	res, _, err := req.Post(endpoint)
... ...
@@ -50,14 +50,14 @@ func TestResizeWithInvalidSize(t *testing.T) {
50 50
 
51 51
 func TestResizeWhenContainerNotStarted(t *testing.T) {
52 52
 	defer setupTest(t)()
53
-	client := testEnv.APIClient()
53
+	apiClient := testEnv.APIClient()
54 54
 	ctx := context.Background()
55 55
 
56
-	cID := container.Run(ctx, t, client, container.WithCmd("echo"))
56
+	cID := container.Run(ctx, t, apiClient, container.WithCmd("echo"))
57 57
 
58
-	poll.WaitOn(t, container.IsInState(ctx, client, cID, "exited"), poll.WithDelay(100*time.Millisecond))
58
+	poll.WaitOn(t, container.IsInState(ctx, apiClient, cID, "exited"), poll.WithDelay(100*time.Millisecond))
59 59
 
60
-	err := client.ContainerResize(ctx, cID, types.ResizeOptions{
60
+	err := apiClient.ContainerResize(ctx, cID, types.ResizeOptions{
61 61
 		Height: 40,
62 62
 		Width:  40,
63 63
 	})
... ...
@@ -84,7 +84,7 @@ func TestDaemonRestartKillContainers(t *testing.T) {
84 84
 					t.Parallel()
85 85
 
86 86
 					d := daemon.New(t)
87
-					client := d.NewClientT(t)
87
+					apiClient := d.NewClientT(t)
88 88
 
89 89
 					args := []string{"--iptables=false"}
90 90
 					if liveRestoreEnabled {
... ...
@@ -95,12 +95,12 @@ func TestDaemonRestartKillContainers(t *testing.T) {
95 95
 					defer d.Stop(t)
96 96
 					ctx := context.Background()
97 97
 
98
-					resp, err := client.ContainerCreate(ctx, tc.config, tc.hostConfig, nil, nil, "")
98
+					resp, err := apiClient.ContainerCreate(ctx, tc.config, tc.hostConfig, nil, nil, "")
99 99
 					assert.NilError(t, err)
100
-					defer client.ContainerRemove(ctx, resp.ID, types.ContainerRemoveOptions{Force: true})
100
+					defer apiClient.ContainerRemove(ctx, resp.ID, types.ContainerRemoveOptions{Force: true})
101 101
 
102 102
 					if tc.xStart {
103
-						err = client.ContainerStart(ctx, resp.ID, types.ContainerStartOptions{})
103
+						err = apiClient.ContainerStart(ctx, resp.ID, types.ContainerStartOptions{})
104 104
 						assert.NilError(t, err)
105 105
 					}
106 106
 
... ...
@@ -114,7 +114,7 @@ func TestDaemonRestartKillContainers(t *testing.T) {
114 114
 
115 115
 					var running bool
116 116
 					for i := 0; i < 30; i++ {
117
-						inspect, err := client.ContainerInspect(ctx, resp.ID)
117
+						inspect, err := apiClient.ContainerInspect(ctx, resp.ID)
118 118
 						assert.NilError(t, err)
119 119
 
120 120
 						running = inspect.State.Running
... ...
@@ -129,7 +129,7 @@ func TestDaemonRestartKillContainers(t *testing.T) {
129 129
 						startTime := time.Now()
130 130
 						ctxPoll, cancel := context.WithTimeout(ctx, 30*time.Second)
131 131
 						defer cancel()
132
-						poll.WaitOn(t, pollForNewHealthCheck(ctxPoll, client, startTime, resp.ID), poll.WithDelay(100*time.Millisecond))
132
+						poll.WaitOn(t, pollForNewHealthCheck(ctxPoll, apiClient, startTime, resp.ID), poll.WithDelay(100*time.Millisecond))
133 133
 					}
134 134
 					// TODO(cpuguy83): test pause states... this seems to be rather undefined currently
135 135
 				})
... ...
@@ -158,7 +158,7 @@ func pollForNewHealthCheck(ctx context.Context, client *client.Client, startTime
158 158
 // It should be removed only if killed or stopped
159 159
 func TestContainerWithAutoRemoveCanBeRestarted(t *testing.T) {
160 160
 	defer setupTest(t)()
161
-	cli := testEnv.APIClient()
161
+	apiClient := testEnv.APIClient()
162 162
 	ctx := context.Background()
163 163
 
164 164
 	noWaitTimeout := 0
... ...
@@ -170,42 +170,42 @@ func TestContainerWithAutoRemoveCanBeRestarted(t *testing.T) {
170 170
 		{
171 171
 			desc: "kill",
172 172
 			doSth: func(ctx context.Context, containerID string) error {
173
-				return cli.ContainerKill(ctx, containerID, "SIGKILL")
173
+				return apiClient.ContainerKill(ctx, containerID, "SIGKILL")
174 174
 			},
175 175
 		},
176 176
 		{
177 177
 			desc: "stop",
178 178
 			doSth: func(ctx context.Context, containerID string) error {
179
-				return cli.ContainerStop(ctx, containerID, container.StopOptions{Timeout: &noWaitTimeout})
179
+				return apiClient.ContainerStop(ctx, containerID, container.StopOptions{Timeout: &noWaitTimeout})
180 180
 			},
181 181
 		},
182 182
 	} {
183 183
 		tc := tc
184 184
 		t.Run(tc.desc, func(t *testing.T) {
185
-			cID := testContainer.Run(ctx, t, cli,
185
+			cID := testContainer.Run(ctx, t, apiClient,
186 186
 				testContainer.WithName("autoremove-restart-and-"+tc.desc),
187 187
 				testContainer.WithAutoRemove,
188 188
 			)
189 189
 			defer func() {
190
-				err := cli.ContainerRemove(ctx, cID, types.ContainerRemoveOptions{Force: true})
190
+				err := apiClient.ContainerRemove(ctx, cID, types.ContainerRemoveOptions{Force: true})
191 191
 				if t.Failed() && err != nil {
192 192
 					t.Logf("Cleaning up test container failed with error: %v", err)
193 193
 				}
194 194
 			}()
195 195
 
196
-			err := cli.ContainerRestart(ctx, cID, container.StopOptions{Timeout: &noWaitTimeout})
196
+			err := apiClient.ContainerRestart(ctx, cID, container.StopOptions{Timeout: &noWaitTimeout})
197 197
 			assert.NilError(t, err)
198 198
 
199
-			inspect, err := cli.ContainerInspect(ctx, cID)
199
+			inspect, err := apiClient.ContainerInspect(ctx, cID)
200 200
 			assert.NilError(t, err)
201 201
 			assert.Assert(t, inspect.State.Status != "removing", "Container should not be removing yet")
202 202
 
203
-			poll.WaitOn(t, testContainer.IsInState(ctx, cli, cID, "running"))
203
+			poll.WaitOn(t, testContainer.IsInState(ctx, apiClient, cID, "running"))
204 204
 
205 205
 			err = tc.doSth(ctx, cID)
206 206
 			assert.NilError(t, err)
207 207
 
208
-			poll.WaitOn(t, testContainer.IsRemoved(ctx, cli, cID))
208
+			poll.WaitOn(t, testContainer.IsRemoved(ctx, apiClient, cID))
209 209
 		})
210 210
 	}
211 211
 }
... ...
@@ -17,17 +17,17 @@ import (
17 17
 // Bring up a daemon with the specified default cgroup namespace mode, and then create a container with the container options
18 18
 func testRunWithCgroupNs(t *testing.T, daemonNsMode string, containerOpts ...func(*container.TestContainerConfig)) (string, string) {
19 19
 	d := daemon.New(t, daemon.WithDefaultCgroupNamespaceMode(daemonNsMode))
20
-	client := d.NewClientT(t)
20
+	apiClient := d.NewClientT(t)
21 21
 	ctx := context.Background()
22 22
 
23 23
 	d.StartWithBusybox(t)
24 24
 	defer d.Stop(t)
25 25
 
26
-	cID := container.Run(ctx, t, client, containerOpts...)
27
-	poll.WaitOn(t, container.IsInState(ctx, client, cID, "running"), poll.WithDelay(100*time.Millisecond))
26
+	cID := container.Run(ctx, t, apiClient, containerOpts...)
27
+	poll.WaitOn(t, container.IsInState(ctx, apiClient, cID, "running"), poll.WithDelay(100*time.Millisecond))
28 28
 
29 29
 	daemonCgroup := d.CgroupNamespace(t)
30
-	containerCgroup := container.GetContainerNS(ctx, t, client, cID, "cgroup")
30
+	containerCgroup := container.GetContainerNS(ctx, t, apiClient, cID, "cgroup")
31 31
 	return containerCgroup, daemonCgroup
32 32
 }
33 33
 
... ...
@@ -35,12 +35,12 @@ func testRunWithCgroupNs(t *testing.T, daemonNsMode string, containerOpts ...fun
35 35
 // expecting an error with the specified string
36 36
 func testCreateFailureWithCgroupNs(t *testing.T, daemonNsMode string, errStr string, containerOpts ...func(*container.TestContainerConfig)) {
37 37
 	d := daemon.New(t, daemon.WithDefaultCgroupNamespaceMode(daemonNsMode))
38
-	client := d.NewClientT(t)
38
+	apiClient := d.NewClientT(t)
39 39
 	ctx := context.Background()
40 40
 
41 41
 	d.StartWithBusybox(t)
42 42
 	defer d.Stop(t)
43
-	container.CreateExpectingErr(ctx, t, client, errStr, containerOpts...)
43
+	container.CreateExpectingErr(ctx, t, apiClient, errStr, containerOpts...)
44 44
 }
45 45
 
46 46
 func TestCgroupNamespacesRun(t *testing.T) {
... ...
@@ -126,17 +126,17 @@ func TestCgroupNamespacesRunOlderClient(t *testing.T) {
126 126
 	skip.If(t, !requirement.CgroupNamespacesEnabled())
127 127
 
128 128
 	d := daemon.New(t, daemon.WithDefaultCgroupNamespaceMode("private"))
129
-	client := d.NewClientT(t, client.WithVersion("1.39"))
129
+	apiClient := d.NewClientT(t, client.WithVersion("1.39"))
130 130
 
131 131
 	ctx := context.Background()
132 132
 	d.StartWithBusybox(t)
133 133
 	defer d.Stop(t)
134 134
 
135
-	cID := container.Run(ctx, t, client)
136
-	poll.WaitOn(t, container.IsInState(ctx, client, cID, "running"), poll.WithDelay(100*time.Millisecond))
135
+	cID := container.Run(ctx, t, apiClient)
136
+	poll.WaitOn(t, container.IsInState(ctx, apiClient, cID, "running"), poll.WithDelay(100*time.Millisecond))
137 137
 
138 138
 	daemonCgroup := d.CgroupNamespace(t)
139
-	containerCgroup := container.GetContainerNS(ctx, t, client, cID, "cgroup")
139
+	containerCgroup := container.GetContainerNS(ctx, t, apiClient, cID, "cgroup")
140 140
 	if testEnv.DaemonInfo.CgroupVersion != "2" {
141 141
 		assert.Assert(t, daemonCgroup == containerCgroup)
142 142
 	} else {
... ...
@@ -38,7 +38,7 @@ func TestNISDomainname(t *testing.T) {
38 38
 	skip.If(t, testEnv.IsRootless, "rootless mode doesn't support setting Domainname (TODO: https://github.com/moby/moby/issues/40632)")
39 39
 
40 40
 	defer setupTest(t)()
41
-	client := testEnv.APIClient()
41
+	apiClient := testEnv.APIClient()
42 42
 	ctx := context.Background()
43 43
 
44 44
 	const (
... ...
@@ -46,20 +46,20 @@ func TestNISDomainname(t *testing.T) {
46 46
 		domainname = "baz.cyphar.com"
47 47
 	)
48 48
 
49
-	cID := container.Run(ctx, t, client, func(c *container.TestContainerConfig) {
49
+	cID := container.Run(ctx, t, apiClient, func(c *container.TestContainerConfig) {
50 50
 		c.Config.Hostname = hostname
51 51
 		c.Config.Domainname = domainname
52 52
 	})
53 53
 
54
-	poll.WaitOn(t, container.IsInState(ctx, client, cID, "running"), poll.WithDelay(100*time.Millisecond))
54
+	poll.WaitOn(t, container.IsInState(ctx, apiClient, cID, "running"), poll.WithDelay(100*time.Millisecond))
55 55
 
56
-	inspect, err := client.ContainerInspect(ctx, cID)
56
+	inspect, err := apiClient.ContainerInspect(ctx, cID)
57 57
 	assert.NilError(t, err)
58 58
 	assert.Check(t, is.Equal(hostname, inspect.Config.Hostname))
59 59
 	assert.Check(t, is.Equal(domainname, inspect.Config.Domainname))
60 60
 
61 61
 	// Check hostname.
62
-	res, err := container.Exec(ctx, client, cID,
62
+	res, err := container.Exec(ctx, apiClient, cID,
63 63
 		[]string{"cat", "/proc/sys/kernel/hostname"})
64 64
 	assert.NilError(t, err)
65 65
 	assert.Assert(t, is.Len(res.Stderr(), 0))
... ...
@@ -67,7 +67,7 @@ func TestNISDomainname(t *testing.T) {
67 67
 	assert.Check(t, is.Equal(hostname, strings.TrimSpace(res.Stdout())))
68 68
 
69 69
 	// Check domainname.
70
-	res, err = container.Exec(ctx, client, cID,
70
+	res, err = container.Exec(ctx, apiClient, cID,
71 71
 		[]string{"cat", "/proc/sys/kernel/domainname"})
72 72
 	assert.NilError(t, err)
73 73
 	assert.Assert(t, is.Len(res.Stderr(), 0))
... ...
@@ -79,7 +79,7 @@ func TestHostnameDnsResolution(t *testing.T) {
79 79
 	skip.If(t, testEnv.DaemonInfo.OSType != "linux")
80 80
 
81 81
 	defer setupTest(t)()
82
-	client := testEnv.APIClient()
82
+	apiClient := testEnv.APIClient()
83 83
 	ctx := context.Background()
84 84
 
85 85
 	const (
... ...
@@ -88,21 +88,21 @@ func TestHostnameDnsResolution(t *testing.T) {
88 88
 
89 89
 	// using user defined network as we want to use internal DNS
90 90
 	netName := "foobar-net"
91
-	net.CreateNoError(context.Background(), t, client, netName, net.WithDriver("bridge"))
91
+	net.CreateNoError(context.Background(), t, apiClient, netName, net.WithDriver("bridge"))
92 92
 
93
-	cID := container.Run(ctx, t, client, func(c *container.TestContainerConfig) {
93
+	cID := container.Run(ctx, t, apiClient, func(c *container.TestContainerConfig) {
94 94
 		c.Config.Hostname = hostname
95 95
 		c.HostConfig.NetworkMode = containertypes.NetworkMode(netName)
96 96
 	})
97 97
 
98
-	poll.WaitOn(t, container.IsInState(ctx, client, cID, "running"), poll.WithDelay(100*time.Millisecond))
98
+	poll.WaitOn(t, container.IsInState(ctx, apiClient, cID, "running"), poll.WithDelay(100*time.Millisecond))
99 99
 
100
-	inspect, err := client.ContainerInspect(ctx, cID)
100
+	inspect, err := apiClient.ContainerInspect(ctx, cID)
101 101
 	assert.NilError(t, err)
102 102
 	assert.Check(t, is.Equal(hostname, inspect.Config.Hostname))
103 103
 
104 104
 	// Clear hosts file so ping will use DNS for hostname resolution
105
-	res, err := container.Exec(ctx, client, cID,
105
+	res, err := container.Exec(ctx, apiClient, cID,
106 106
 		[]string{"sh", "-c", "echo 127.0.0.1 localhost | tee /etc/hosts && ping -c 1 foobar"})
107 107
 	assert.NilError(t, err)
108 108
 	assert.Check(t, is.Equal("", res.Stderr()))
... ...
@@ -114,24 +114,24 @@ func TestUnprivilegedPortsAndPing(t *testing.T) {
114 114
 	skip.If(t, testEnv.IsRootless, "rootless mode doesn't support setting net.ipv4.ping_group_range and net.ipv4.ip_unprivileged_port_start")
115 115
 
116 116
 	defer setupTest(t)()
117
-	client := testEnv.APIClient()
117
+	apiClient := testEnv.APIClient()
118 118
 	ctx := context.Background()
119 119
 
120
-	cID := container.Run(ctx, t, client, func(c *container.TestContainerConfig) {
120
+	cID := container.Run(ctx, t, apiClient, func(c *container.TestContainerConfig) {
121 121
 		c.Config.User = "1000:1000"
122 122
 	})
123 123
 
124
-	poll.WaitOn(t, container.IsInState(ctx, client, cID, "running"), poll.WithDelay(100*time.Millisecond))
124
+	poll.WaitOn(t, container.IsInState(ctx, apiClient, cID, "running"), poll.WithDelay(100*time.Millisecond))
125 125
 
126 126
 	// Check net.ipv4.ping_group_range.
127
-	res, err := container.Exec(ctx, client, cID, []string{"cat", "/proc/sys/net/ipv4/ping_group_range"})
127
+	res, err := container.Exec(ctx, apiClient, cID, []string{"cat", "/proc/sys/net/ipv4/ping_group_range"})
128 128
 	assert.NilError(t, err)
129 129
 	assert.Assert(t, is.Len(res.Stderr(), 0))
130 130
 	assert.Equal(t, 0, res.ExitCode)
131 131
 	assert.Equal(t, `0	2147483647`, strings.TrimSpace(res.Stdout()))
132 132
 
133 133
 	// Check net.ipv4.ip_unprivileged_port_start.
134
-	res, err = container.Exec(ctx, client, cID, []string{"cat", "/proc/sys/net/ipv4/ip_unprivileged_port_start"})
134
+	res, err = container.Exec(ctx, apiClient, cID, []string{"cat", "/proc/sys/net/ipv4/ip_unprivileged_port_start"})
135 135
 	assert.NilError(t, err)
136 136
 	assert.Assert(t, is.Len(res.Stderr(), 0))
137 137
 	assert.Equal(t, 0, res.ExitCode)
... ...
@@ -145,7 +145,7 @@ func TestPrivilegedHostDevices(t *testing.T) {
145 145
 	skip.If(t, testEnv.DaemonInfo.OSType != "linux")
146 146
 
147 147
 	defer setupTest(t)()
148
-	client := testEnv.APIClient()
148
+	apiClient := testEnv.APIClient()
149 149
 	ctx := context.Background()
150 150
 
151 151
 	const (
... ...
@@ -167,18 +167,18 @@ func TestPrivilegedHostDevices(t *testing.T) {
167 167
 	}
168 168
 	defer os.Remove(devRootOnlyTest)
169 169
 
170
-	cID := container.Run(ctx, t, client, container.WithPrivileged(true))
170
+	cID := container.Run(ctx, t, apiClient, container.WithPrivileged(true))
171 171
 
172
-	poll.WaitOn(t, container.IsInState(ctx, client, cID, "running"), poll.WithDelay(100*time.Millisecond))
172
+	poll.WaitOn(t, container.IsInState(ctx, apiClient, cID, "running"), poll.WithDelay(100*time.Millisecond))
173 173
 
174 174
 	// Check test device.
175
-	res, err := container.Exec(ctx, client, cID, []string{"ls", devTest})
175
+	res, err := container.Exec(ctx, apiClient, cID, []string{"ls", devTest})
176 176
 	assert.NilError(t, err)
177 177
 	assert.Equal(t, 0, res.ExitCode)
178 178
 	assert.Check(t, is.Equal(strings.TrimSpace(res.Stdout()), devTest))
179 179
 
180 180
 	// Check root-only test device.
181
-	res, err = container.Exec(ctx, client, cID, []string{"ls", devRootOnlyTest})
181
+	res, err = container.Exec(ctx, apiClient, cID, []string{"ls", devRootOnlyTest})
182 182
 	assert.NilError(t, err)
183 183
 	if testEnv.IsRootless() {
184 184
 		assert.Equal(t, 1, res.ExitCode)
... ...
@@ -194,19 +194,19 @@ func TestRunConsoleSize(t *testing.T) {
194 194
 	skip.If(t, versions.LessThan(testEnv.DaemonAPIVersion(), "1.42"), "skip test from new feature")
195 195
 
196 196
 	defer setupTest(t)()
197
-	client := testEnv.APIClient()
197
+	apiClient := testEnv.APIClient()
198 198
 	ctx := context.Background()
199 199
 
200
-	cID := container.Run(ctx, t, client,
200
+	cID := container.Run(ctx, t, apiClient,
201 201
 		container.WithTty(true),
202 202
 		container.WithImage("busybox"),
203 203
 		container.WithCmd("stty", "size"),
204 204
 		container.WithConsoleSize(57, 123),
205 205
 	)
206 206
 
207
-	poll.WaitOn(t, container.IsStopped(ctx, client, cID), poll.WithDelay(100*time.Millisecond))
207
+	poll.WaitOn(t, container.IsStopped(ctx, apiClient, cID), poll.WithDelay(100*time.Millisecond))
208 208
 
209
-	out, err := client.ContainerLogs(ctx, cID, types.ContainerLogsOptions{ShowStdout: true})
209
+	out, err := apiClient.ContainerLogs(ctx, cID, types.ContainerLogsOptions{ShowStdout: true})
210 210
 	assert.NilError(t, err)
211 211
 	defer out.Close()
212 212
 
... ...
@@ -249,18 +249,18 @@ func TestRunWithAlternativeContainerdShim(t *testing.T) {
249 249
 	d.StartWithBusybox(t)
250 250
 	defer d.Stop(t)
251 251
 
252
-	client := d.NewClientT(t)
252
+	apiClient := d.NewClientT(t)
253 253
 	ctx := context.Background()
254 254
 
255
-	cID := container.Run(ctx, t, client,
255
+	cID := container.Run(ctx, t, apiClient,
256 256
 		container.WithImage("busybox"),
257 257
 		container.WithCmd("sh", "-c", `echo 'Hello, world!'`),
258 258
 		container.WithRuntime("io.containerd.realfake.v42"),
259 259
 	)
260 260
 
261
-	poll.WaitOn(t, container.IsStopped(ctx, client, cID), poll.WithDelay(100*time.Millisecond))
261
+	poll.WaitOn(t, container.IsStopped(ctx, apiClient, cID), poll.WithDelay(100*time.Millisecond))
262 262
 
263
-	out, err := client.ContainerLogs(ctx, cID, types.ContainerLogsOptions{ShowStdout: true})
263
+	out, err := apiClient.ContainerLogs(ctx, cID, types.ContainerLogsOptions{ShowStdout: true})
264 264
 	assert.NilError(t, err)
265 265
 	defer out.Close()
266 266
 
... ...
@@ -273,14 +273,14 @@ func TestRunWithAlternativeContainerdShim(t *testing.T) {
273 273
 	d.Stop(t)
274 274
 	d.Start(t, "--default-runtime="+"io.containerd.realfake.v42")
275 275
 
276
-	cID = container.Run(ctx, t, client,
276
+	cID = container.Run(ctx, t, apiClient,
277 277
 		container.WithImage("busybox"),
278 278
 		container.WithCmd("sh", "-c", `echo 'Hello, world!'`),
279 279
 	)
280 280
 
281
-	poll.WaitOn(t, container.IsStopped(ctx, client, cID), poll.WithDelay(100*time.Millisecond))
281
+	poll.WaitOn(t, container.IsStopped(ctx, apiClient, cID), poll.WithDelay(100*time.Millisecond))
282 282
 
283
-	out, err = client.ContainerLogs(ctx, cID, types.ContainerLogsOptions{ShowStdout: true})
283
+	out, err = apiClient.ContainerLogs(ctx, cID, types.ContainerLogsOptions{ShowStdout: true})
284 284
 	assert.NilError(t, err)
285 285
 	defer out.Close()
286 286
 
... ...
@@ -21,17 +21,17 @@ func TestStats(t *testing.T) {
21 21
 	skip.If(t, !testEnv.DaemonInfo.MemoryLimit)
22 22
 
23 23
 	defer setupTest(t)()
24
-	client := testEnv.APIClient()
24
+	apiClient := testEnv.APIClient()
25 25
 	ctx := context.Background()
26 26
 
27
-	info, err := client.Info(ctx)
27
+	info, err := apiClient.Info(ctx)
28 28
 	assert.NilError(t, err)
29 29
 
30
-	cID := container.Run(ctx, t, client)
30
+	cID := container.Run(ctx, t, apiClient)
31 31
 
32
-	poll.WaitOn(t, container.IsInState(ctx, client, cID, "running"), poll.WithDelay(100*time.Millisecond))
32
+	poll.WaitOn(t, container.IsInState(ctx, apiClient, cID, "running"), poll.WithDelay(100*time.Millisecond))
33 33
 
34
-	resp, err := client.ContainerStats(ctx, cID, false)
34
+	resp, err := apiClient.ContainerStats(ctx, cID, false)
35 35
 	assert.NilError(t, err)
36 36
 	defer resp.Body.Close()
37 37
 
... ...
@@ -43,7 +43,7 @@ func TestStats(t *testing.T) {
43 43
 	err = json.NewDecoder(resp.Body).Decode(&v)
44 44
 	assert.Assert(t, is.ErrorContains(err, ""), io.EOF)
45 45
 
46
-	resp, err = client.ContainerStatsOneShot(ctx, cID)
46
+	resp, err = apiClient.ContainerStatsOneShot(ctx, cID)
47 47
 	assert.NilError(t, err)
48 48
 	defer resp.Body.Close()
49 49
 
... ...
@@ -25,7 +25,7 @@ import (
25 25
 // waiting is not limited (issue #35311).
26 26
 func TestStopContainerWithTimeout(t *testing.T) {
27 27
 	t.Cleanup(setupTest(t))
28
-	client := testEnv.APIClient()
28
+	apiClient := testEnv.APIClient()
29 29
 	ctx := context.Background()
30 30
 
31 31
 	testCmd := container.WithCmd("sh", "-c", "sleep 2 && exit 42")
... ...
@@ -58,15 +58,15 @@ func TestStopContainerWithTimeout(t *testing.T) {
58 58
 		d := d
59 59
 		t.Run(strconv.Itoa(d.timeout), func(t *testing.T) {
60 60
 			t.Parallel()
61
-			id := container.Run(ctx, t, client, testCmd)
61
+			id := container.Run(ctx, t, apiClient, testCmd)
62 62
 
63
-			err := client.ContainerStop(ctx, id, containertypes.StopOptions{Timeout: &d.timeout})
63
+			err := apiClient.ContainerStop(ctx, id, containertypes.StopOptions{Timeout: &d.timeout})
64 64
 			assert.NilError(t, err)
65 65
 
66
-			poll.WaitOn(t, container.IsStopped(ctx, client, id),
66
+			poll.WaitOn(t, container.IsStopped(ctx, apiClient, id),
67 67
 				poll.WithDelay(100*time.Millisecond))
68 68
 
69
-			inspect, err := client.ContainerInspect(ctx, id)
69
+			inspect, err := apiClient.ContainerInspect(ctx, id)
70 70
 			assert.NilError(t, err)
71 71
 			assert.Equal(t, inspect.State.ExitCode, d.expectedExitCode)
72 72
 		})
... ...
@@ -16,12 +16,12 @@ const StopContainerWindowsPollTimeout = 75 * time.Second
16 16
 
17 17
 func TestStopContainerWithRestartPolicyAlways(t *testing.T) {
18 18
 	defer setupTest(t)()
19
-	client := testEnv.APIClient()
19
+	apiClient := testEnv.APIClient()
20 20
 	ctx := context.Background()
21 21
 
22 22
 	names := []string{"verifyRestart1-" + t.Name(), "verifyRestart2-" + t.Name()}
23 23
 	for _, name := range names {
24
-		container.Run(ctx, t, client,
24
+		container.Run(ctx, t, apiClient,
25 25
 			container.WithName(name),
26 26
 			container.WithCmd("false"),
27 27
 			container.WithRestartPolicy("always"),
... ...
@@ -29,15 +29,15 @@ func TestStopContainerWithRestartPolicyAlways(t *testing.T) {
29 29
 	}
30 30
 
31 31
 	for _, name := range names {
32
-		poll.WaitOn(t, container.IsInState(ctx, client, name, "running", "restarting"), poll.WithDelay(100*time.Millisecond))
32
+		poll.WaitOn(t, container.IsInState(ctx, apiClient, name, "running", "restarting"), poll.WithDelay(100*time.Millisecond))
33 33
 	}
34 34
 
35 35
 	for _, name := range names {
36
-		err := client.ContainerStop(ctx, name, containertypes.StopOptions{})
36
+		err := apiClient.ContainerStop(ctx, name, containertypes.StopOptions{})
37 37
 		assert.NilError(t, err)
38 38
 	}
39 39
 
40 40
 	for _, name := range names {
41
-		poll.WaitOn(t, container.IsStopped(ctx, client, name), poll.WithDelay(100*time.Millisecond))
41
+		poll.WaitOn(t, container.IsStopped(ctx, apiClient, name), poll.WithDelay(100*time.Millisecond))
42 42
 	}
43 43
 }
... ...
@@ -19,7 +19,7 @@ import (
19 19
 func TestStopContainerWithTimeout(t *testing.T) {
20 20
 	skip.If(t, testEnv.DaemonInfo.OSType == "windows")
21 21
 	t.Cleanup(setupTest(t))
22
-	client := testEnv.APIClient()
22
+	apiClient := testEnv.APIClient()
23 23
 	ctx := context.Background()
24 24
 
25 25
 	testCmd := container.WithCmd("sh", "-c", "sleep 2 && exit 42")
... ...
@@ -52,15 +52,15 @@ func TestStopContainerWithTimeout(t *testing.T) {
52 52
 		d := d
53 53
 		t.Run(strconv.Itoa(d.timeout), func(t *testing.T) {
54 54
 			t.Parallel()
55
-			id := container.Run(ctx, t, client, testCmd)
55
+			id := container.Run(ctx, t, apiClient, testCmd)
56 56
 
57
-			err := client.ContainerStop(ctx, id, containertypes.StopOptions{Timeout: &d.timeout})
57
+			err := apiClient.ContainerStop(ctx, id, containertypes.StopOptions{Timeout: &d.timeout})
58 58
 			assert.NilError(t, err)
59 59
 
60
-			poll.WaitOn(t, container.IsStopped(ctx, client, id),
60
+			poll.WaitOn(t, container.IsStopped(ctx, apiClient, id),
61 61
 				poll.WithDelay(100*time.Millisecond))
62 62
 
63
-			inspect, err := client.ContainerInspect(ctx, id)
63
+			inspect, err := apiClient.ContainerInspect(ctx, id)
64 64
 			assert.NilError(t, err)
65 65
 			assert.Equal(t, inspect.State.ExitCode, d.expectedExitCode)
66 66
 		})
... ...
@@ -24,23 +24,23 @@ func TestUpdateMemory(t *testing.T) {
24 24
 	skip.If(t, !testEnv.DaemonInfo.SwapLimit)
25 25
 
26 26
 	defer setupTest(t)()
27
-	client := testEnv.APIClient()
27
+	apiClient := testEnv.APIClient()
28 28
 	ctx := context.Background()
29 29
 
30
-	cID := container.Run(ctx, t, client, func(c *container.TestContainerConfig) {
30
+	cID := container.Run(ctx, t, apiClient, func(c *container.TestContainerConfig) {
31 31
 		c.HostConfig.Resources = containertypes.Resources{
32 32
 			Memory: 200 * 1024 * 1024,
33 33
 		}
34 34
 	})
35 35
 
36
-	poll.WaitOn(t, container.IsInState(ctx, client, cID, "running"), poll.WithDelay(100*time.Millisecond))
36
+	poll.WaitOn(t, container.IsInState(ctx, apiClient, cID, "running"), poll.WithDelay(100*time.Millisecond))
37 37
 
38 38
 	const (
39 39
 		setMemory     int64 = 314572800
40 40
 		setMemorySwap int64 = 524288000
41 41
 	)
42 42
 
43
-	_, err := client.ContainerUpdate(ctx, cID, containertypes.UpdateConfig{
43
+	_, err := apiClient.ContainerUpdate(ctx, cID, containertypes.UpdateConfig{
44 44
 		Resources: containertypes.Resources{
45 45
 			Memory:     setMemory,
46 46
 			MemorySwap: setMemorySwap,
... ...
@@ -48,7 +48,7 @@ func TestUpdateMemory(t *testing.T) {
48 48
 	})
49 49
 	assert.NilError(t, err)
50 50
 
51
-	inspect, err := client.ContainerInspect(ctx, cID)
51
+	inspect, err := apiClient.ContainerInspect(ctx, cID)
52 52
 	assert.NilError(t, err)
53 53
 	assert.Check(t, is.Equal(setMemory, inspect.HostConfig.Memory))
54 54
 	assert.Check(t, is.Equal(setMemorySwap, inspect.HostConfig.MemorySwap))
... ...
@@ -57,7 +57,7 @@ func TestUpdateMemory(t *testing.T) {
57 57
 	if testEnv.DaemonInfo.CgroupVersion == "2" {
58 58
 		memoryFile = "/sys/fs/cgroup/memory.max"
59 59
 	}
60
-	res, err := container.Exec(ctx, client, cID,
60
+	res, err := container.Exec(ctx, apiClient, cID,
61 61
 		[]string{"cat", memoryFile})
62 62
 	assert.NilError(t, err)
63 63
 	assert.Assert(t, is.Len(res.Stderr(), 0))
... ...
@@ -67,14 +67,14 @@ func TestUpdateMemory(t *testing.T) {
67 67
 	// see ConvertMemorySwapToCgroupV2Value() for the convention:
68 68
 	// https://github.com/opencontainers/runc/commit/c86be8a2c118ca7bad7bbe9eaf106c659a83940d
69 69
 	if testEnv.DaemonInfo.CgroupVersion == "2" {
70
-		res, err = container.Exec(ctx, client, cID,
70
+		res, err = container.Exec(ctx, apiClient, cID,
71 71
 			[]string{"cat", "/sys/fs/cgroup/memory.swap.max"})
72 72
 		assert.NilError(t, err)
73 73
 		assert.Assert(t, is.Len(res.Stderr(), 0))
74 74
 		assert.Equal(t, 0, res.ExitCode)
75 75
 		assert.Check(t, is.Equal(strconv.FormatInt(setMemorySwap-setMemory, 10), strings.TrimSpace(res.Stdout())))
76 76
 	} else {
77
-		res, err = container.Exec(ctx, client, cID,
77
+		res, err = container.Exec(ctx, apiClient, cID,
78 78
 			[]string{"cat", "/sys/fs/cgroup/memory/memory.memsw.limit_in_bytes"})
79 79
 		assert.NilError(t, err)
80 80
 		assert.Assert(t, is.Len(res.Stderr(), 0))
... ...
@@ -86,10 +86,10 @@ func TestUpdateMemory(t *testing.T) {
86 86
 func TestUpdateCPUQuota(t *testing.T) {
87 87
 	skip.If(t, testEnv.DaemonInfo.CgroupDriver == "none")
88 88
 	defer setupTest(t)()
89
-	client := testEnv.APIClient()
89
+	apiClient := testEnv.APIClient()
90 90
 	ctx := context.Background()
91 91
 
92
-	cID := container.Run(ctx, t, client)
92
+	cID := container.Run(ctx, t, apiClient)
93 93
 
94 94
 	for _, test := range []struct {
95 95
 		desc   string
... ...
@@ -104,7 +104,7 @@ func TestUpdateCPUQuota(t *testing.T) {
104 104
 			// On v2, specifying CPUQuota without CPUPeriod is currently broken:
105 105
 			// https://github.com/opencontainers/runc/issues/2456
106 106
 			// As a workaround we set them together.
107
-			_, err := client.ContainerUpdate(ctx, cID, containertypes.UpdateConfig{
107
+			_, err := apiClient.ContainerUpdate(ctx, cID, containertypes.UpdateConfig{
108 108
 				Resources: containertypes.Resources{
109 109
 					CPUQuota:  test.update,
110 110
 					CPUPeriod: 100000,
... ...
@@ -112,7 +112,7 @@ func TestUpdateCPUQuota(t *testing.T) {
112 112
 			})
113 113
 			assert.NilError(t, err)
114 114
 		} else {
115
-			_, err := client.ContainerUpdate(ctx, cID, containertypes.UpdateConfig{
115
+			_, err := apiClient.ContainerUpdate(ctx, cID, containertypes.UpdateConfig{
116 116
 				Resources: containertypes.Resources{
117 117
 					CPUQuota: test.update,
118 118
 				},
... ...
@@ -120,12 +120,12 @@ func TestUpdateCPUQuota(t *testing.T) {
120 120
 			assert.NilError(t, err)
121 121
 		}
122 122
 
123
-		inspect, err := client.ContainerInspect(ctx, cID)
123
+		inspect, err := apiClient.ContainerInspect(ctx, cID)
124 124
 		assert.NilError(t, err)
125 125
 		assert.Check(t, is.Equal(test.update, inspect.HostConfig.CPUQuota))
126 126
 
127 127
 		if testEnv.DaemonInfo.CgroupVersion == "2" {
128
-			res, err := container.Exec(ctx, client, cID,
128
+			res, err := container.Exec(ctx, apiClient, cID,
129 129
 				[]string{"/bin/cat", "/sys/fs/cgroup/cpu.max"})
130 130
 			assert.NilError(t, err)
131 131
 			assert.Assert(t, is.Len(res.Stderr(), 0))
... ...
@@ -139,7 +139,7 @@ func TestUpdateCPUQuota(t *testing.T) {
139 139
 				assert.Check(t, is.Equal(strconv.FormatInt(test.update, 10), quota))
140 140
 			}
141 141
 		} else {
142
-			res, err := container.Exec(ctx, client, cID,
142
+			res, err := container.Exec(ctx, apiClient, cID,
143 143
 				[]string{"/bin/cat", "/sys/fs/cgroup/cpu/cpu.cfs_quota_us"})
144 144
 			assert.NilError(t, err)
145 145
 			assert.Assert(t, is.Len(res.Stderr(), 0))
... ...
@@ -157,7 +157,7 @@ func TestUpdatePidsLimit(t *testing.T) {
157 157
 
158 158
 	defer setupTest(t)()
159 159
 	apiClient := testEnv.APIClient()
160
-	oldAPIclient := request.NewAPIClient(t, client.WithVersion("1.24"))
160
+	oldAPIClient := request.NewAPIClient(t, client.WithVersion("1.24"))
161 161
 	ctx := context.Background()
162 162
 
163 163
 	intPtr := func(i int64) *int64 {
... ...
@@ -182,7 +182,7 @@ func TestUpdatePidsLimit(t *testing.T) {
182 182
 	} {
183 183
 		c := apiClient
184 184
 		if test.oldAPI {
185
-			c = oldAPIclient
185
+			c = oldAPIClient
186 186
 		}
187 187
 
188 188
 		t.Run(test.desc, func(t *testing.T) {
... ...
@@ -14,17 +14,17 @@ import (
14 14
 
15 15
 func TestUpdateRestartPolicy(t *testing.T) {
16 16
 	defer setupTest(t)()
17
-	client := testEnv.APIClient()
17
+	apiClient := testEnv.APIClient()
18 18
 	ctx := context.Background()
19 19
 
20
-	cID := container.Run(ctx, t, client, container.WithCmd("sh", "-c", "sleep 1 && false"), func(c *container.TestContainerConfig) {
20
+	cID := container.Run(ctx, t, apiClient, container.WithCmd("sh", "-c", "sleep 1 && false"), func(c *container.TestContainerConfig) {
21 21
 		c.HostConfig.RestartPolicy = containertypes.RestartPolicy{
22 22
 			Name:              "on-failure",
23 23
 			MaximumRetryCount: 3,
24 24
 		}
25 25
 	})
26 26
 
27
-	_, err := client.ContainerUpdate(ctx, cID, containertypes.UpdateConfig{
27
+	_, err := apiClient.ContainerUpdate(ctx, cID, containertypes.UpdateConfig{
28 28
 		RestartPolicy: containertypes.RestartPolicy{
29 29
 			Name:              "on-failure",
30 30
 			MaximumRetryCount: 5,
... ...
@@ -37,9 +37,9 @@ func TestUpdateRestartPolicy(t *testing.T) {
37 37
 		timeout = 180 * time.Second
38 38
 	}
39 39
 
40
-	poll.WaitOn(t, container.IsInState(ctx, client, cID, "exited"), poll.WithDelay(100*time.Millisecond), poll.WithTimeout(timeout))
40
+	poll.WaitOn(t, container.IsInState(ctx, apiClient, cID, "exited"), poll.WithDelay(100*time.Millisecond), poll.WithTimeout(timeout))
41 41
 
42
-	inspect, err := client.ContainerInspect(ctx, cID)
42
+	inspect, err := apiClient.ContainerInspect(ctx, cID)
43 43
 	assert.NilError(t, err)
44 44
 	assert.Check(t, is.Equal(inspect.RestartCount, 5))
45 45
 	assert.Check(t, is.Equal(inspect.HostConfig.RestartPolicy.MaximumRetryCount, 5))
... ...
@@ -47,12 +47,12 @@ func TestUpdateRestartPolicy(t *testing.T) {
47 47
 
48 48
 func TestUpdateRestartWithAutoRemove(t *testing.T) {
49 49
 	defer setupTest(t)()
50
-	client := testEnv.APIClient()
50
+	apiClient := testEnv.APIClient()
51 51
 	ctx := context.Background()
52 52
 
53
-	cID := container.Run(ctx, t, client, container.WithAutoRemove)
53
+	cID := container.Run(ctx, t, apiClient, container.WithAutoRemove)
54 54
 
55
-	_, err := client.ContainerUpdate(ctx, cID, containertypes.UpdateConfig{
55
+	_, err := apiClient.ContainerUpdate(ctx, cID, containertypes.UpdateConfig{
56 56
 		RestartPolicy: containertypes.RestartPolicy{
57 57
 			Name: "always",
58 58
 		},