Browse code

integration-cli: rename vars that collided with imports

- use apiClient for api-clients to reduce shadowing (also more "accurate")
- use "ctr" instead of "container"

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

Sebastiaan van Stijn authored on 2023/04/03 20:00:29
Showing 15 changed files
... ...
@@ -174,9 +174,9 @@ func (s *DockerAPISuite) TestPostContainersAttach(c *testing.T) {
174 174
 	expectTimeout(wc, br, "stdout")
175 175
 
176 176
 	// Test the client API
177
-	client, err := client.NewClientWithOpts(client.FromEnv)
177
+	apiClient, err := client.NewClientWithOpts(client.FromEnv)
178 178
 	assert.NilError(c, err)
179
-	defer client.Close()
179
+	defer apiClient.Close()
180 180
 
181 181
 	cid, _ = dockerCmd(c, "run", "-di", "busybox", "/bin/sh", "-c", "echo hello; cat")
182 182
 	cid = strings.TrimSpace(cid)
... ...
@@ -190,7 +190,7 @@ func (s *DockerAPISuite) TestPostContainersAttach(c *testing.T) {
190 190
 		Logs:   false,
191 191
 	}
192 192
 
193
-	resp, err := client.ContainerAttach(context.Background(), cid, attachOpts)
193
+	resp, err := apiClient.ContainerAttach(context.Background(), cid, attachOpts)
194 194
 	assert.NilError(c, err)
195 195
 	mediaType, b := resp.MediaType()
196 196
 	assert.Check(c, b)
... ...
@@ -199,7 +199,7 @@ func (s *DockerAPISuite) TestPostContainersAttach(c *testing.T) {
199 199
 
200 200
 	// Make sure we do see "hello" if Logs is true
201 201
 	attachOpts.Logs = true
202
-	resp, err = client.ContainerAttach(context.Background(), cid, attachOpts)
202
+	resp, err = apiClient.ContainerAttach(context.Background(), cid, attachOpts)
203 203
 	assert.NilError(c, err)
204 204
 
205 205
 	defer resp.Conn.Close()
... ...
@@ -256,11 +256,11 @@ func requestHijack(method, endpoint string, data io.Reader, ct, daemon string, m
256 256
 		return nil, nil, errors.Wrap(err, "configure Transport error")
257 257
 	}
258 258
 
259
-	client := http.Client{
259
+	c := http.Client{
260 260
 		Transport: transport,
261 261
 	}
262 262
 
263
-	resp, err := client.Do(req)
263
+	resp, err := c.Do(req)
264 264
 	if err != nil {
265 265
 		return nil, nil, errors.Wrap(err, "client.Do")
266 266
 	}
... ...
@@ -40,14 +40,14 @@ func (s *DockerAPISuite) TestContainerAPIGetAll(c *testing.T) {
40 40
 	name := "getall"
41 41
 	dockerCmd(c, "run", "--name", name, "busybox", "true")
42 42
 
43
-	cli, err := client.NewClientWithOpts(client.FromEnv)
43
+	apiClient, err := client.NewClientWithOpts(client.FromEnv)
44 44
 	assert.NilError(c, err)
45
-	defer cli.Close()
45
+	defer apiClient.Close()
46 46
 
47 47
 	options := types.ContainerListOptions{
48 48
 		All: true,
49 49
 	}
50
-	containers, err := cli.ContainerList(context.Background(), options)
50
+	containers, err := apiClient.ContainerList(context.Background(), options)
51 51
 	assert.NilError(c, err)
52 52
 	assert.Equal(c, len(containers), startCount+1)
53 53
 	actual := containers[0].Names[0]
... ...
@@ -59,14 +59,14 @@ func (s *DockerAPISuite) TestContainerAPIGetJSONNoFieldsOmitted(c *testing.T) {
59 59
 	startCount := getContainerCount(c)
60 60
 	dockerCmd(c, "run", "busybox", "true")
61 61
 
62
-	cli, err := client.NewClientWithOpts(client.FromEnv)
62
+	apiClient, err := client.NewClientWithOpts(client.FromEnv)
63 63
 	assert.NilError(c, err)
64
-	defer cli.Close()
64
+	defer apiClient.Close()
65 65
 
66 66
 	options := types.ContainerListOptions{
67 67
 		All: true,
68 68
 	}
69
-	containers, err := cli.ContainerList(context.Background(), options)
69
+	containers, err := apiClient.ContainerList(context.Background(), options)
70 70
 	assert.NilError(c, err)
71 71
 	assert.Equal(c, len(containers), startCount+1)
72 72
 	actual := fmt.Sprintf("%+v", containers[0])
... ...
@@ -101,11 +101,11 @@ func (s *DockerAPISuite) TestContainerAPIGetExport(c *testing.T) {
101 101
 	name := "exportcontainer"
102 102
 	dockerCmd(c, "run", "--name", name, "busybox", "touch", "/test")
103 103
 
104
-	cli, err := client.NewClientWithOpts(client.FromEnv)
104
+	apiClient, err := client.NewClientWithOpts(client.FromEnv)
105 105
 	assert.NilError(c, err)
106
-	defer cli.Close()
106
+	defer apiClient.Close()
107 107
 
108
-	body, err := cli.ContainerExport(context.Background(), name)
108
+	body, err := apiClient.ContainerExport(context.Background(), name)
109 109
 	assert.NilError(c, err)
110 110
 	defer body.Close()
111 111
 	found := false
... ...
@@ -128,11 +128,11 @@ func (s *DockerAPISuite) TestContainerAPIGetChanges(c *testing.T) {
128 128
 	name := "changescontainer"
129 129
 	dockerCmd(c, "run", "--name", name, "busybox", "rm", "/etc/passwd")
130 130
 
131
-	cli, err := client.NewClientWithOpts(client.FromEnv)
131
+	apiClient, err := client.NewClientWithOpts(client.FromEnv)
132 132
 	assert.NilError(c, err)
133
-	defer cli.Close()
133
+	defer apiClient.Close()
134 134
 
135
-	changes, err := cli.ContainerDiff(context.Background(), name)
135
+	changes, err := apiClient.ContainerDiff(context.Background(), name)
136 136
 	assert.NilError(c, err)
137 137
 
138 138
 	// Check the changelog for removal of /etc/passwd
... ...
@@ -158,11 +158,11 @@ func (s *DockerAPISuite) TestGetContainerStats(c *testing.T) {
158 158
 
159 159
 	bc := make(chan b, 1)
160 160
 	go func() {
161
-		cli, err := client.NewClientWithOpts(client.FromEnv)
161
+		apiClient, err := client.NewClientWithOpts(client.FromEnv)
162 162
 		assert.NilError(c, err)
163
-		defer cli.Close()
163
+		defer apiClient.Close()
164 164
 
165
-		stats, err := cli.ContainerStats(context.Background(), name, true)
165
+		stats, err := apiClient.ContainerStats(context.Background(), name, true)
166 166
 		assert.NilError(c, err)
167 167
 		bc <- b{stats, err}
168 168
 	}()
... ...
@@ -192,11 +192,11 @@ func (s *DockerAPISuite) TestGetContainerStatsRmRunning(c *testing.T) {
192 192
 	buf := &ChannelBuffer{C: make(chan []byte, 1)}
193 193
 	defer buf.Close()
194 194
 
195
-	cli, err := client.NewClientWithOpts(client.FromEnv)
195
+	apiClient, err := client.NewClientWithOpts(client.FromEnv)
196 196
 	assert.NilError(c, err)
197
-	defer cli.Close()
197
+	defer apiClient.Close()
198 198
 
199
-	stats, err := cli.ContainerStats(context.Background(), id, true)
199
+	stats, err := apiClient.ContainerStats(context.Background(), id, true)
200 200
 	assert.NilError(c, err)
201 201
 	defer stats.Body.Close()
202 202
 
... ...
@@ -263,11 +263,11 @@ func (s *DockerAPISuite) TestGetContainerStatsStream(c *testing.T) {
263 263
 
264 264
 	bc := make(chan b, 1)
265 265
 	go func() {
266
-		cli, err := client.NewClientWithOpts(client.FromEnv)
266
+		apiClient, err := client.NewClientWithOpts(client.FromEnv)
267 267
 		assert.NilError(c, err)
268
-		defer cli.Close()
268
+		defer apiClient.Close()
269 269
 
270
-		stats, err := cli.ContainerStats(context.Background(), name, true)
270
+		stats, err := apiClient.ContainerStats(context.Background(), name, true)
271 271
 		assert.NilError(c, err)
272 272
 		bc <- b{stats, err}
273 273
 	}()
... ...
@@ -305,11 +305,11 @@ func (s *DockerAPISuite) TestGetContainerStatsNoStream(c *testing.T) {
305 305
 	bc := make(chan b, 1)
306 306
 
307 307
 	go func() {
308
-		cli, err := client.NewClientWithOpts(client.FromEnv)
308
+		apiClient, err := client.NewClientWithOpts(client.FromEnv)
309 309
 		assert.NilError(c, err)
310
-		defer cli.Close()
310
+		defer apiClient.Close()
311 311
 
312
-		stats, err := cli.ContainerStats(context.Background(), name, false)
312
+		stats, err := apiClient.ContainerStats(context.Background(), name, false)
313 313
 		assert.NilError(c, err)
314 314
 		bc <- b{stats, err}
315 315
 	}()
... ...
@@ -342,11 +342,11 @@ func (s *DockerAPISuite) TestGetStoppedContainerStats(c *testing.T) {
342 342
 	// We expect an immediate response, but if it's not immediate, the test would hang, so put it in a goroutine
343 343
 	// below we'll check this on a timeout.
344 344
 	go func() {
345
-		cli, err := client.NewClientWithOpts(client.FromEnv)
345
+		apiClient, err := client.NewClientWithOpts(client.FromEnv)
346 346
 		assert.NilError(c, err)
347
-		defer cli.Close()
347
+		defer apiClient.Close()
348 348
 
349
-		resp, err := cli.ContainerStats(context.Background(), name, false)
349
+		resp, err := apiClient.ContainerStats(context.Background(), name, false)
350 350
 		assert.NilError(c, err)
351 351
 		defer resp.Body.Close()
352 352
 		chResp <- err
... ...
@@ -371,11 +371,11 @@ func (s *DockerAPISuite) TestContainerAPIPause(c *testing.T) {
371 371
 	out := cli.DockerCmd(c, "run", "-d", "busybox", "sleep", "30").Combined()
372 372
 	ContainerID := strings.TrimSpace(out)
373 373
 
374
-	cli, err := client.NewClientWithOpts(client.FromEnv)
374
+	apiClient, err := client.NewClientWithOpts(client.FromEnv)
375 375
 	assert.NilError(c, err)
376
-	defer cli.Close()
376
+	defer apiClient.Close()
377 377
 
378
-	err = cli.ContainerPause(context.Background(), ContainerID)
378
+	err = apiClient.ContainerPause(context.Background(), ContainerID)
379 379
 	assert.NilError(c, err)
380 380
 
381 381
 	pausedContainers := getPaused(c)
... ...
@@ -384,7 +384,7 @@ func (s *DockerAPISuite) TestContainerAPIPause(c *testing.T) {
384 384
 		c.Fatalf("there should be one paused container and not %d", len(pausedContainers))
385 385
 	}
386 386
 
387
-	err = cli.ContainerUnpause(context.Background(), ContainerID)
387
+	err = apiClient.ContainerUnpause(context.Background(), ContainerID)
388 388
 	assert.NilError(c, err)
389 389
 
390 390
 	pausedContainers = getPaused(c)
... ...
@@ -397,12 +397,12 @@ func (s *DockerAPISuite) TestContainerAPITop(c *testing.T) {
397 397
 	id := strings.TrimSpace(out)
398 398
 	assert.NilError(c, waitRun(id))
399 399
 
400
-	cli, err := client.NewClientWithOpts(client.FromEnv)
400
+	apiClient, err := client.NewClientWithOpts(client.FromEnv)
401 401
 	assert.NilError(c, err)
402
-	defer cli.Close()
402
+	defer apiClient.Close()
403 403
 
404 404
 	// sort by comm[andline] to make sure order stays the same in case of PID rollover
405
-	top, err := cli.ContainerTop(context.Background(), id, []string{"aux", "--sort=comm"})
405
+	top, err := apiClient.ContainerTop(context.Background(), id, []string{"aux", "--sort=comm"})
406 406
 	assert.NilError(c, err)
407 407
 	assert.Equal(c, len(top.Titles), 11, fmt.Sprintf("expected 11 titles, found %d: %v", len(top.Titles), top.Titles))
408 408
 
... ...
@@ -420,11 +420,11 @@ func (s *DockerAPISuite) TestContainerAPITopWindows(c *testing.T) {
420 420
 	id := strings.TrimSpace(out)
421 421
 	assert.NilError(c, waitRun(id))
422 422
 
423
-	cli, err := client.NewClientWithOpts(client.FromEnv)
423
+	apiClient, err := client.NewClientWithOpts(client.FromEnv)
424 424
 	assert.NilError(c, err)
425
-	defer cli.Close()
425
+	defer apiClient.Close()
426 426
 
427
-	top, err := cli.ContainerTop(context.Background(), id, nil)
427
+	top, err := apiClient.ContainerTop(context.Background(), id, nil)
428 428
 	assert.NilError(c, err)
429 429
 	assert.Equal(c, len(top.Titles), 4, "expected 4 titles, found %d: %v", len(top.Titles), top.Titles)
430 430
 
... ...
@@ -449,15 +449,15 @@ func (s *DockerAPISuite) TestContainerAPICommit(c *testing.T) {
449 449
 	cName := "testapicommit"
450 450
 	dockerCmd(c, "run", "--name="+cName, "busybox", "/bin/sh", "-c", "touch /test")
451 451
 
452
-	cli, err := client.NewClientWithOpts(client.FromEnv)
452
+	apiClient, err := client.NewClientWithOpts(client.FromEnv)
453 453
 	assert.NilError(c, err)
454
-	defer cli.Close()
454
+	defer apiClient.Close()
455 455
 
456 456
 	options := types.ContainerCommitOptions{
457 457
 		Reference: "testcontainerapicommit:testtag",
458 458
 	}
459 459
 
460
-	img, err := cli.ContainerCommit(context.Background(), cName, options)
460
+	img, err := apiClient.ContainerCommit(context.Background(), cName, options)
461 461
 	assert.NilError(c, err)
462 462
 
463 463
 	cmd := inspectField(c, img.ID, "Config.Cmd")
... ...
@@ -471,9 +471,9 @@ func (s *DockerAPISuite) TestContainerAPICommitWithLabelInConfig(c *testing.T) {
471 471
 	cName := "testapicommitwithconfig"
472 472
 	dockerCmd(c, "run", "--name="+cName, "busybox", "/bin/sh", "-c", "touch /test")
473 473
 
474
-	cli, err := client.NewClientWithOpts(client.FromEnv)
474
+	apiClient, err := client.NewClientWithOpts(client.FromEnv)
475 475
 	assert.NilError(c, err)
476
-	defer cli.Close()
476
+	defer apiClient.Close()
477 477
 
478 478
 	config := container.Config{
479 479
 		Labels: map[string]string{"key1": "value1", "key2": "value2"}}
... ...
@@ -483,7 +483,7 @@ func (s *DockerAPISuite) TestContainerAPICommitWithLabelInConfig(c *testing.T) {
483 483
 		Config:    &config,
484 484
 	}
485 485
 
486
-	img, err := cli.ContainerCommit(context.Background(), cName, options)
486
+	img, err := apiClient.ContainerCommit(context.Background(), cName, options)
487 487
 	assert.NilError(c, err)
488 488
 
489 489
 	label1 := inspectFieldMap(c, img.ID, "Config.Labels", "key1")
... ...
@@ -518,11 +518,11 @@ func (s *DockerAPISuite) TestContainerAPIBadPort(c *testing.T) {
518 518
 		},
519 519
 	}
520 520
 
521
-	cli, err := client.NewClientWithOpts(client.FromEnv)
521
+	apiClient, err := client.NewClientWithOpts(client.FromEnv)
522 522
 	assert.NilError(c, err)
523
-	defer cli.Close()
523
+	defer apiClient.Close()
524 524
 
525
-	_, err = cli.ContainerCreate(context.Background(), &config, &hostConfig, &network.NetworkingConfig{}, nil, "")
525
+	_, err = apiClient.ContainerCreate(context.Background(), &config, &hostConfig, &network.NetworkingConfig{}, nil, "")
526 526
 	assert.ErrorContains(c, err, `invalid port specification: "aa80"`)
527 527
 }
528 528
 
... ...
@@ -532,23 +532,23 @@ func (s *DockerAPISuite) TestContainerAPICreate(c *testing.T) {
532 532
 		Cmd:   []string{"/bin/sh", "-c", "touch /test && ls /test"},
533 533
 	}
534 534
 
535
-	cli, err := client.NewClientWithOpts(client.FromEnv)
535
+	apiClient, err := client.NewClientWithOpts(client.FromEnv)
536 536
 	assert.NilError(c, err)
537
-	defer cli.Close()
537
+	defer apiClient.Close()
538 538
 
539
-	container, err := cli.ContainerCreate(context.Background(), &config, &container.HostConfig{}, &network.NetworkingConfig{}, nil, "")
539
+	ctr, err := apiClient.ContainerCreate(context.Background(), &config, &container.HostConfig{}, &network.NetworkingConfig{}, nil, "")
540 540
 	assert.NilError(c, err)
541 541
 
542
-	out, _ := dockerCmd(c, "start", "-a", container.ID)
542
+	out, _ := dockerCmd(c, "start", "-a", ctr.ID)
543 543
 	assert.Equal(c, strings.TrimSpace(out), "/test")
544 544
 }
545 545
 
546 546
 func (s *DockerAPISuite) TestContainerAPICreateEmptyConfig(c *testing.T) {
547
-	cli, err := client.NewClientWithOpts(client.FromEnv)
547
+	apiClient, err := client.NewClientWithOpts(client.FromEnv)
548 548
 	assert.NilError(c, err)
549
-	defer cli.Close()
549
+	defer apiClient.Close()
550 550
 
551
-	_, err = cli.ContainerCreate(context.Background(), &container.Config{}, &container.HostConfig{}, &network.NetworkingConfig{}, nil, "")
551
+	_, err = apiClient.ContainerCreate(context.Background(), &container.Config{}, &container.HostConfig{}, &network.NetworkingConfig{}, nil, "")
552 552
 
553 553
 	expected := "No command specified"
554 554
 	assert.ErrorContains(c, err, expected)
... ...
@@ -568,11 +568,11 @@ func (s *DockerAPISuite) TestContainerAPICreateMultipleNetworksConfig(c *testing
568 568
 		},
569 569
 	}
570 570
 
571
-	cli, err := client.NewClientWithOpts(client.FromEnv)
571
+	apiClient, err := client.NewClientWithOpts(client.FromEnv)
572 572
 	assert.NilError(c, err)
573
-	defer cli.Close()
573
+	defer apiClient.Close()
574 574
 
575
-	_, err = cli.ContainerCreate(context.Background(), &config, &container.HostConfig{}, &networkingConfig, nil, "")
575
+	_, err = apiClient.ContainerCreate(context.Background(), &config, &container.HostConfig{}, &networkingConfig, nil, "")
576 576
 	msg := err.Error()
577 577
 	// network name order in error message is not deterministic
578 578
 	assert.Assert(c, strings.Contains(msg, "Container cannot be connected to network endpoints"))
... ...
@@ -603,14 +603,14 @@ func UtilCreateNetworkMode(c *testing.T, networkMode container.NetworkMode) {
603 603
 		NetworkMode: networkMode,
604 604
 	}
605 605
 
606
-	cli, err := client.NewClientWithOpts(client.FromEnv)
606
+	apiClient, err := client.NewClientWithOpts(client.FromEnv)
607 607
 	assert.NilError(c, err)
608
-	defer cli.Close()
608
+	defer apiClient.Close()
609 609
 
610
-	container, err := cli.ContainerCreate(context.Background(), &config, &hostConfig, &network.NetworkingConfig{}, nil, "")
610
+	ctr, err := apiClient.ContainerCreate(context.Background(), &config, &hostConfig, &network.NetworkingConfig{}, nil, "")
611 611
 	assert.NilError(c, err)
612 612
 
613
-	containerJSON, err := cli.ContainerInspect(context.Background(), container.ID)
613
+	containerJSON, err := apiClient.ContainerInspect(context.Background(), ctr.ID)
614 614
 	assert.NilError(c, err)
615 615
 
616 616
 	assert.Equal(c, containerJSON.HostConfig.NetworkMode, networkMode, "Mismatched NetworkMode")
... ...
@@ -630,14 +630,14 @@ func (s *DockerAPISuite) TestContainerAPICreateWithCpuSharesCpuset(c *testing.T)
630 630
 		},
631 631
 	}
632 632
 
633
-	cli, err := client.NewClientWithOpts(client.FromEnv)
633
+	apiClient, err := client.NewClientWithOpts(client.FromEnv)
634 634
 	assert.NilError(c, err)
635
-	defer cli.Close()
635
+	defer apiClient.Close()
636 636
 
637
-	container, err := cli.ContainerCreate(context.Background(), &config, &hostConfig, &network.NetworkingConfig{}, nil, "")
637
+	ctr, err := apiClient.ContainerCreate(context.Background(), &config, &hostConfig, &network.NetworkingConfig{}, nil, "")
638 638
 	assert.NilError(c, err)
639 639
 
640
-	containerJSON, err := cli.ContainerInspect(context.Background(), container.ID)
640
+	containerJSON, err := apiClient.ContainerInspect(context.Background(), ctr.ID)
641 641
 	assert.NilError(c, err)
642 642
 
643 643
 	out := inspectField(c, containerJSON.ID, "HostConfig.CpuShares")
... ...
@@ -837,14 +837,14 @@ func (s *DockerAPISuite) TestContainerAPIPostCreateNull(c *testing.T) {
837 837
 	type createResp struct {
838 838
 		ID string
839 839
 	}
840
-	var container createResp
841
-	assert.Assert(c, json.Unmarshal(b, &container) == nil)
842
-	out := inspectField(c, container.ID, "HostConfig.CpusetCpus")
840
+	var ctr createResp
841
+	assert.Assert(c, json.Unmarshal(b, &ctr) == nil)
842
+	out := inspectField(c, ctr.ID, "HostConfig.CpusetCpus")
843 843
 	assert.Equal(c, out, "")
844 844
 
845
-	outMemory := inspectField(c, container.ID, "HostConfig.Memory")
845
+	outMemory := inspectField(c, ctr.ID, "HostConfig.Memory")
846 846
 	assert.Equal(c, outMemory, "0")
847
-	outMemorySwap := inspectField(c, container.ID, "HostConfig.MemorySwap")
847
+	outMemorySwap := inspectField(c, ctr.ID, "HostConfig.MemorySwap")
848 848
 	assert.Equal(c, outMemorySwap, "0")
849 849
 }
850 850
 
... ...
@@ -878,11 +878,11 @@ func (s *DockerAPISuite) TestContainerAPIRename(c *testing.T) {
878 878
 	containerID := strings.TrimSpace(out)
879 879
 	newName := "TestContainerAPIRenameNew"
880 880
 
881
-	cli, err := client.NewClientWithOpts(client.FromEnv)
881
+	apiClient, err := client.NewClientWithOpts(client.FromEnv)
882 882
 	assert.NilError(c, err)
883
-	defer cli.Close()
883
+	defer apiClient.Close()
884 884
 
885
-	err = cli.ContainerRename(context.Background(), containerID, newName)
885
+	err = apiClient.ContainerRename(context.Background(), containerID, newName)
886 886
 	assert.NilError(c, err)
887 887
 
888 888
 	name := inspectField(c, containerID, "Name")
... ...
@@ -893,11 +893,11 @@ func (s *DockerAPISuite) TestContainerAPIKill(c *testing.T) {
893 893
 	name := "test-api-kill"
894 894
 	runSleepingContainer(c, "-i", "--name", name)
895 895
 
896
-	cli, err := client.NewClientWithOpts(client.FromEnv)
896
+	apiClient, err := client.NewClientWithOpts(client.FromEnv)
897 897
 	assert.NilError(c, err)
898
-	defer cli.Close()
898
+	defer apiClient.Close()
899 899
 
900
-	err = cli.ContainerKill(context.Background(), name, "SIGKILL")
900
+	err = apiClient.ContainerKill(context.Background(), name, "SIGKILL")
901 901
 	assert.NilError(c, err)
902 902
 
903 903
 	state := inspectField(c, name, "State.Running")
... ...
@@ -907,12 +907,12 @@ func (s *DockerAPISuite) TestContainerAPIKill(c *testing.T) {
907 907
 func (s *DockerAPISuite) TestContainerAPIRestart(c *testing.T) {
908 908
 	name := "test-api-restart"
909 909
 	runSleepingContainer(c, "-di", "--name", name)
910
-	cli, err := client.NewClientWithOpts(client.FromEnv)
910
+	apiClient, err := client.NewClientWithOpts(client.FromEnv)
911 911
 	assert.NilError(c, err)
912
-	defer cli.Close()
912
+	defer apiClient.Close()
913 913
 
914 914
 	timeout := 1
915
-	err = cli.ContainerRestart(context.Background(), name, container.StopOptions{Timeout: &timeout})
915
+	err = apiClient.ContainerRestart(context.Background(), name, container.StopOptions{Timeout: &timeout})
916 916
 	assert.NilError(c, err)
917 917
 
918 918
 	assert.Assert(c, waitInspect(name, "{{ .State.Restarting  }} {{ .State.Running  }}", "false true", 15*time.Second) == nil)
... ...
@@ -924,11 +924,11 @@ func (s *DockerAPISuite) TestContainerAPIRestartNotimeoutParam(c *testing.T) {
924 924
 	id := strings.TrimSpace(out)
925 925
 	assert.NilError(c, waitRun(id))
926 926
 
927
-	cli, err := client.NewClientWithOpts(client.FromEnv)
927
+	apiClient, err := client.NewClientWithOpts(client.FromEnv)
928 928
 	assert.NilError(c, err)
929
-	defer cli.Close()
929
+	defer apiClient.Close()
930 930
 
931
-	err = cli.ContainerRestart(context.Background(), name, container.StopOptions{})
931
+	err = apiClient.ContainerRestart(context.Background(), name, container.StopOptions{})
932 932
 	assert.NilError(c, err)
933 933
 
934 934
 	assert.Assert(c, waitInspect(name, "{{ .State.Restarting  }} {{ .State.Running  }}", "false true", 15*time.Second) == nil)
... ...
@@ -942,19 +942,19 @@ func (s *DockerAPISuite) TestContainerAPIStart(c *testing.T) {
942 942
 		OpenStdin: true,
943 943
 	}
944 944
 
945
-	cli, err := client.NewClientWithOpts(client.FromEnv)
945
+	apiClient, err := client.NewClientWithOpts(client.FromEnv)
946 946
 	assert.NilError(c, err)
947
-	defer cli.Close()
947
+	defer apiClient.Close()
948 948
 
949
-	_, err = cli.ContainerCreate(context.Background(), &config, &container.HostConfig{}, &network.NetworkingConfig{}, nil, name)
949
+	_, err = apiClient.ContainerCreate(context.Background(), &config, &container.HostConfig{}, &network.NetworkingConfig{}, nil, name)
950 950
 	assert.NilError(c, err)
951 951
 
952
-	err = cli.ContainerStart(context.Background(), name, types.ContainerStartOptions{})
952
+	err = apiClient.ContainerStart(context.Background(), name, types.ContainerStartOptions{})
953 953
 	assert.NilError(c, err)
954 954
 
955 955
 	// second call to start should give 304
956 956
 	// maybe add ContainerStartWithRaw to test it
957
-	err = cli.ContainerStart(context.Background(), name, types.ContainerStartOptions{})
957
+	err = apiClient.ContainerStart(context.Background(), name, types.ContainerStartOptions{})
958 958
 	assert.NilError(c, err)
959 959
 
960 960
 	// TODO(tibor): figure out why this doesn't work on windows
... ...
@@ -965,11 +965,11 @@ func (s *DockerAPISuite) TestContainerAPIStop(c *testing.T) {
965 965
 	runSleepingContainer(c, "-i", "--name", name)
966 966
 	timeout := 30
967 967
 
968
-	cli, err := client.NewClientWithOpts(client.FromEnv)
968
+	apiClient, err := client.NewClientWithOpts(client.FromEnv)
969 969
 	assert.NilError(c, err)
970
-	defer cli.Close()
970
+	defer apiClient.Close()
971 971
 
972
-	err = cli.ContainerStop(context.Background(), name, container.StopOptions{
972
+	err = apiClient.ContainerStop(context.Background(), name, container.StopOptions{
973 973
 		Timeout: &timeout,
974 974
 	})
975 975
 	assert.NilError(c, err)
... ...
@@ -977,7 +977,7 @@ func (s *DockerAPISuite) TestContainerAPIStop(c *testing.T) {
977 977
 
978 978
 	// second call to start should give 304
979 979
 	// maybe add ContainerStartWithRaw to test it
980
-	err = cli.ContainerStop(context.Background(), name, container.StopOptions{
980
+	err = apiClient.ContainerStop(context.Background(), name, container.StopOptions{
981 981
 		Timeout: &timeout,
982 982
 	})
983 983
 	assert.NilError(c, err)
... ...
@@ -992,11 +992,11 @@ func (s *DockerAPISuite) TestContainerAPIWait(c *testing.T) {
992 992
 	}
993 993
 	dockerCmd(c, "run", "--name", name, "busybox", sleepCmd, "2")
994 994
 
995
-	cli, err := client.NewClientWithOpts(client.FromEnv)
995
+	apiClient, err := client.NewClientWithOpts(client.FromEnv)
996 996
 	assert.NilError(c, err)
997
-	defer cli.Close()
997
+	defer apiClient.Close()
998 998
 
999
-	waitResC, errC := cli.ContainerWait(context.Background(), name, "")
999
+	waitResC, errC := apiClient.ContainerWait(context.Background(), name, "")
1000 1000
 
1001 1001
 	select {
1002 1002
 	case err = <-errC:
... ...
@@ -1110,20 +1110,20 @@ func (s *DockerAPISuite) TestContainerAPIDelete(c *testing.T) {
1110 1110
 
1111 1111
 	dockerCmd(c, "stop", id)
1112 1112
 
1113
-	cli, err := client.NewClientWithOpts(client.FromEnv)
1113
+	apiClient, err := client.NewClientWithOpts(client.FromEnv)
1114 1114
 	assert.NilError(c, err)
1115
-	defer cli.Close()
1115
+	defer apiClient.Close()
1116 1116
 
1117
-	err = cli.ContainerRemove(context.Background(), id, types.ContainerRemoveOptions{})
1117
+	err = apiClient.ContainerRemove(context.Background(), id, types.ContainerRemoveOptions{})
1118 1118
 	assert.NilError(c, err)
1119 1119
 }
1120 1120
 
1121 1121
 func (s *DockerAPISuite) TestContainerAPIDeleteNotExist(c *testing.T) {
1122
-	cli, err := client.NewClientWithOpts(client.FromEnv)
1122
+	apiClient, err := client.NewClientWithOpts(client.FromEnv)
1123 1123
 	assert.NilError(c, err)
1124
-	defer cli.Close()
1124
+	defer apiClient.Close()
1125 1125
 
1126
-	err = cli.ContainerRemove(context.Background(), "doesnotexist", types.ContainerRemoveOptions{})
1126
+	err = apiClient.ContainerRemove(context.Background(), "doesnotexist", types.ContainerRemoveOptions{})
1127 1127
 	assert.ErrorContains(c, err, "No such container: doesnotexist")
1128 1128
 }
1129 1129
 
... ...
@@ -1136,11 +1136,11 @@ func (s *DockerAPISuite) TestContainerAPIDeleteForce(c *testing.T) {
1136 1136
 		Force: true,
1137 1137
 	}
1138 1138
 
1139
-	cli, err := client.NewClientWithOpts(client.FromEnv)
1139
+	apiClient, err := client.NewClientWithOpts(client.FromEnv)
1140 1140
 	assert.NilError(c, err)
1141
-	defer cli.Close()
1141
+	defer apiClient.Close()
1142 1142
 
1143
-	err = cli.ContainerRemove(context.Background(), id, removeOptions)
1143
+	err = apiClient.ContainerRemove(context.Background(), id, removeOptions)
1144 1144
 	assert.NilError(c, err)
1145 1145
 }
1146 1146
 
... ...
@@ -1164,11 +1164,11 @@ func (s *DockerAPISuite) TestContainerAPIDeleteRemoveLinks(c *testing.T) {
1164 1164
 		RemoveLinks: true,
1165 1165
 	}
1166 1166
 
1167
-	cli, err := client.NewClientWithOpts(client.FromEnv)
1167
+	apiClient, err := client.NewClientWithOpts(client.FromEnv)
1168 1168
 	assert.NilError(c, err)
1169
-	defer cli.Close()
1169
+	defer apiClient.Close()
1170 1170
 
1171
-	err = cli.ContainerRemove(context.Background(), "tlink2/tlink1", removeOptions)
1171
+	err = apiClient.ContainerRemove(context.Background(), "tlink2/tlink1", removeOptions)
1172 1172
 	assert.NilError(c, err)
1173 1173
 
1174 1174
 	linksPostRm := inspectFieldJSON(c, id2, "HostConfig.Links")
... ...
@@ -1181,11 +1181,11 @@ func (s *DockerAPISuite) TestContainerAPIDeleteConflict(c *testing.T) {
1181 1181
 	id := strings.TrimSpace(out)
1182 1182
 	assert.NilError(c, waitRun(id))
1183 1183
 
1184
-	cli, err := client.NewClientWithOpts(client.FromEnv)
1184
+	apiClient, err := client.NewClientWithOpts(client.FromEnv)
1185 1185
 	assert.NilError(c, err)
1186
-	defer cli.Close()
1186
+	defer apiClient.Close()
1187 1187
 
1188
-	err = cli.ContainerRemove(context.Background(), id, types.ContainerRemoveOptions{})
1188
+	err = apiClient.ContainerRemove(context.Background(), id, types.ContainerRemoveOptions{})
1189 1189
 	expected := "cannot remove a running container"
1190 1190
 	assert.ErrorContains(c, err, expected)
1191 1191
 }
... ...
@@ -1213,11 +1213,11 @@ func (s *DockerAPISuite) TestContainerAPIDeleteRemoveVolume(c *testing.T) {
1213 1213
 		RemoveVolumes: true,
1214 1214
 	}
1215 1215
 
1216
-	cli, err := client.NewClientWithOpts(client.FromEnv)
1216
+	apiClient, err := client.NewClientWithOpts(client.FromEnv)
1217 1217
 	assert.NilError(c, err)
1218
-	defer cli.Close()
1218
+	defer apiClient.Close()
1219 1219
 
1220
-	err = cli.ContainerRemove(context.Background(), id, removeOptions)
1220
+	err = apiClient.ContainerRemove(context.Background(), id, removeOptions)
1221 1221
 	assert.NilError(c, err)
1222 1222
 
1223 1223
 	_, err = os.Stat(source)
... ...
@@ -1250,11 +1250,11 @@ func (s *DockerAPISuite) TestContainerAPIPostContainerStop(c *testing.T) {
1250 1250
 	containerID := strings.TrimSpace(out)
1251 1251
 	assert.Assert(c, waitRun(containerID) == nil)
1252 1252
 
1253
-	cli, err := client.NewClientWithOpts(client.FromEnv)
1253
+	apiClient, err := client.NewClientWithOpts(client.FromEnv)
1254 1254
 	assert.NilError(c, err)
1255
-	defer cli.Close()
1255
+	defer apiClient.Close()
1256 1256
 
1257
-	err = cli.ContainerStop(context.Background(), containerID, container.StopOptions{})
1257
+	err = apiClient.ContainerStop(context.Background(), containerID, container.StopOptions{})
1258 1258
 	assert.NilError(c, err)
1259 1259
 	assert.Assert(c, waitInspect(containerID, "{{ .State.Running  }}", "false", 60*time.Second) == nil)
1260 1260
 }
... ...
@@ -1267,11 +1267,11 @@ func (s *DockerAPISuite) TestPostContainerAPICreateWithStringOrSliceEntrypoint(c
1267 1267
 		Cmd:        []string{"hello", "world"},
1268 1268
 	}
1269 1269
 
1270
-	cli, err := client.NewClientWithOpts(client.FromEnv)
1270
+	apiClient, err := client.NewClientWithOpts(client.FromEnv)
1271 1271
 	assert.NilError(c, err)
1272
-	defer cli.Close()
1272
+	defer apiClient.Close()
1273 1273
 
1274
-	_, err = cli.ContainerCreate(context.Background(), &config, &container.HostConfig{}, &network.NetworkingConfig{}, nil, "echotest")
1274
+	_, err = apiClient.ContainerCreate(context.Background(), &config, &container.HostConfig{}, &network.NetworkingConfig{}, nil, "echotest")
1275 1275
 	assert.NilError(c, err)
1276 1276
 	out, _ := dockerCmd(c, "start", "-a", "echotest")
1277 1277
 	assert.Equal(c, strings.TrimSpace(out), "hello world")
... ...
@@ -1294,11 +1294,11 @@ func (s *DockerAPISuite) TestPostContainersCreateWithStringOrSliceCmd(c *testing
1294 1294
 		Cmd:   []string{"echo", "hello", "world"},
1295 1295
 	}
1296 1296
 
1297
-	cli, err := client.NewClientWithOpts(client.FromEnv)
1297
+	apiClient, err := client.NewClientWithOpts(client.FromEnv)
1298 1298
 	assert.NilError(c, err)
1299
-	defer cli.Close()
1299
+	defer apiClient.Close()
1300 1300
 
1301
-	_, err = cli.ContainerCreate(context.Background(), &config, &container.HostConfig{}, &network.NetworkingConfig{}, nil, "echotest")
1301
+	_, err = apiClient.ContainerCreate(context.Background(), &config, &container.HostConfig{}, &network.NetworkingConfig{}, nil, "echotest")
1302 1302
 	assert.NilError(c, err)
1303 1303
 	out, _ := dockerCmd(c, "start", "-a", "echotest")
1304 1304
 	assert.Equal(c, strings.TrimSpace(out), "hello world")
... ...
@@ -1337,11 +1337,11 @@ func (s *DockerAPISuite) TestPostContainersCreateWithStringOrSliceCapAddDrop(c *
1337 1337
 		CapDrop: []string{"SETGID", "CAP_SETPCAP"},
1338 1338
 	}
1339 1339
 
1340
-	cli, err := client.NewClientWithOpts(client.FromEnv)
1340
+	apiClient, err := client.NewClientWithOpts(client.FromEnv)
1341 1341
 	assert.NilError(c, err)
1342
-	defer cli.Close()
1342
+	defer apiClient.Close()
1343 1343
 
1344
-	_, err = cli.ContainerCreate(context.Background(), &config2, &hostConfig, &network.NetworkingConfig{}, nil, "capaddtest1")
1344
+	_, err = apiClient.ContainerCreate(context.Background(), &config2, &hostConfig, &network.NetworkingConfig{}, nil, "capaddtest1")
1345 1345
 	assert.NilError(c, err)
1346 1346
 }
1347 1347
 
... ...
@@ -1352,10 +1352,10 @@ func (s *DockerAPISuite) TestContainerAPICreateNoHostConfig118(c *testing.T) {
1352 1352
 		Image: "busybox",
1353 1353
 	}
1354 1354
 
1355
-	cli, err := client.NewClientWithOpts(client.FromEnv, client.WithVersion("v1.18"))
1355
+	apiClient, err := client.NewClientWithOpts(client.FromEnv, client.WithVersion("v1.18"))
1356 1356
 	assert.NilError(c, err)
1357 1357
 
1358
-	_, err = cli.ContainerCreate(context.Background(), &config, &container.HostConfig{}, &network.NetworkingConfig{}, nil, "")
1358
+	_, err = apiClient.ContainerCreate(context.Background(), &config, &container.HostConfig{}, &network.NetworkingConfig{}, nil, "")
1359 1359
 	assert.NilError(c, err)
1360 1360
 }
1361 1361
 
... ...
@@ -1381,10 +1381,10 @@ func (s *DockerAPISuite) TestPutContainerArchiveErrSymlinkInVolumeToReadOnlyRoot
1381 1381
 	// Attempt to extract to a symlink in the volume which points to a
1382 1382
 	// directory outside the volume. This should cause an error because the
1383 1383
 	// rootfs is read-only.
1384
-	cli, err := client.NewClientWithOpts(client.FromEnv, client.WithVersion("v1.20"))
1384
+	apiClient, err := client.NewClientWithOpts(client.FromEnv, client.WithVersion("v1.20"))
1385 1385
 	assert.NilError(c, err)
1386 1386
 
1387
-	err = cli.CopyToContainer(context.Background(), cID, "/vol2/symlinkToAbsDir", nil, types.CopyToContainerOptions{})
1387
+	err = apiClient.CopyToContainer(context.Background(), cID, "/vol2/symlinkToAbsDir", nil, types.CopyToContainerOptions{})
1388 1388
 	assert.ErrorContains(c, err, "container rootfs is marked read-only")
1389 1389
 }
1390 1390
 
... ...
@@ -1392,9 +1392,9 @@ func (s *DockerAPISuite) TestPostContainersCreateWithWrongCpusetValues(c *testin
1392 1392
 	// Not supported on Windows
1393 1393
 	testRequires(c, DaemonIsLinux)
1394 1394
 
1395
-	cli, err := client.NewClientWithOpts(client.FromEnv)
1395
+	apiClient, err := client.NewClientWithOpts(client.FromEnv)
1396 1396
 	assert.NilError(c, err)
1397
-	defer cli.Close()
1397
+	defer apiClient.Close()
1398 1398
 
1399 1399
 	config := container.Config{
1400 1400
 		Image: "busybox",
... ...
@@ -1406,7 +1406,7 @@ func (s *DockerAPISuite) TestPostContainersCreateWithWrongCpusetValues(c *testin
1406 1406
 	}
1407 1407
 	name := "wrong-cpuset-cpus"
1408 1408
 
1409
-	_, err = cli.ContainerCreate(context.Background(), &config, &hostConfig1, &network.NetworkingConfig{}, nil, name)
1409
+	_, err = apiClient.ContainerCreate(context.Background(), &config, &hostConfig1, &network.NetworkingConfig{}, nil, name)
1410 1410
 	expected := "Invalid value 1-42,, for cpuset cpus"
1411 1411
 	assert.ErrorContains(c, err, expected)
1412 1412
 
... ...
@@ -1416,7 +1416,7 @@ func (s *DockerAPISuite) TestPostContainersCreateWithWrongCpusetValues(c *testin
1416 1416
 		},
1417 1417
 	}
1418 1418
 	name = "wrong-cpuset-mems"
1419
-	_, err = cli.ContainerCreate(context.Background(), &config, &hostConfig2, &network.NetworkingConfig{}, nil, name)
1419
+	_, err = apiClient.ContainerCreate(context.Background(), &config, &hostConfig2, &network.NetworkingConfig{}, nil, name)
1420 1420
 	expected = "Invalid value 42-3,1-- for cpuset mems"
1421 1421
 	assert.ErrorContains(c, err, expected)
1422 1422
 }
... ...
@@ -1431,11 +1431,11 @@ func (s *DockerAPISuite) TestPostContainersCreateShmSizeNegative(c *testing.T) {
1431 1431
 		ShmSize: -1,
1432 1432
 	}
1433 1433
 
1434
-	cli, err := client.NewClientWithOpts(client.FromEnv)
1434
+	apiClient, err := client.NewClientWithOpts(client.FromEnv)
1435 1435
 	assert.NilError(c, err)
1436
-	defer cli.Close()
1436
+	defer apiClient.Close()
1437 1437
 
1438
-	_, err = cli.ContainerCreate(context.Background(), &config, &hostConfig, &network.NetworkingConfig{}, nil, "")
1438
+	_, err = apiClient.ContainerCreate(context.Background(), &config, &hostConfig, &network.NetworkingConfig{}, nil, "")
1439 1439
 	assert.ErrorContains(c, err, "SHM size can not be less than 0")
1440 1440
 }
1441 1441
 
... ...
@@ -1448,14 +1448,14 @@ func (s *DockerAPISuite) TestPostContainersCreateShmSizeHostConfigOmitted(c *tes
1448 1448
 		Cmd:   []string{"mount"},
1449 1449
 	}
1450 1450
 
1451
-	cli, err := client.NewClientWithOpts(client.FromEnv)
1451
+	apiClient, err := client.NewClientWithOpts(client.FromEnv)
1452 1452
 	assert.NilError(c, err)
1453
-	defer cli.Close()
1453
+	defer apiClient.Close()
1454 1454
 
1455
-	container, err := cli.ContainerCreate(context.Background(), &config, &container.HostConfig{}, &network.NetworkingConfig{}, nil, "")
1455
+	ctr, err := apiClient.ContainerCreate(context.Background(), &config, &container.HostConfig{}, &network.NetworkingConfig{}, nil, "")
1456 1456
 	assert.NilError(c, err)
1457 1457
 
1458
-	containerJSON, err := cli.ContainerInspect(context.Background(), container.ID)
1458
+	containerJSON, err := apiClient.ContainerInspect(context.Background(), ctr.ID)
1459 1459
 	assert.NilError(c, err)
1460 1460
 
1461 1461
 	assert.Equal(c, containerJSON.HostConfig.ShmSize, dconfig.DefaultShmSize)
... ...
@@ -1475,14 +1475,14 @@ func (s *DockerAPISuite) TestPostContainersCreateShmSizeOmitted(c *testing.T) {
1475 1475
 		Cmd:   []string{"mount"},
1476 1476
 	}
1477 1477
 
1478
-	cli, err := client.NewClientWithOpts(client.FromEnv)
1478
+	apiClient, err := client.NewClientWithOpts(client.FromEnv)
1479 1479
 	assert.NilError(c, err)
1480
-	defer cli.Close()
1480
+	defer apiClient.Close()
1481 1481
 
1482
-	container, err := cli.ContainerCreate(context.Background(), &config, &container.HostConfig{}, &network.NetworkingConfig{}, nil, "")
1482
+	ctr, err := apiClient.ContainerCreate(context.Background(), &config, &container.HostConfig{}, &network.NetworkingConfig{}, nil, "")
1483 1483
 	assert.NilError(c, err)
1484 1484
 
1485
-	containerJSON, err := cli.ContainerInspect(context.Background(), container.ID)
1485
+	containerJSON, err := apiClient.ContainerInspect(context.Background(), ctr.ID)
1486 1486
 	assert.NilError(c, err)
1487 1487
 
1488 1488
 	assert.Equal(c, containerJSON.HostConfig.ShmSize, int64(67108864))
... ...
@@ -1506,14 +1506,14 @@ func (s *DockerAPISuite) TestPostContainersCreateWithShmSize(c *testing.T) {
1506 1506
 		ShmSize: 1073741824,
1507 1507
 	}
1508 1508
 
1509
-	cli, err := client.NewClientWithOpts(client.FromEnv)
1509
+	apiClient, err := client.NewClientWithOpts(client.FromEnv)
1510 1510
 	assert.NilError(c, err)
1511
-	defer cli.Close()
1511
+	defer apiClient.Close()
1512 1512
 
1513
-	container, err := cli.ContainerCreate(context.Background(), &config, &hostConfig, &network.NetworkingConfig{}, nil, "")
1513
+	ctr, err := apiClient.ContainerCreate(context.Background(), &config, &hostConfig, &network.NetworkingConfig{}, nil, "")
1514 1514
 	assert.NilError(c, err)
1515 1515
 
1516
-	containerJSON, err := cli.ContainerInspect(context.Background(), container.ID)
1516
+	containerJSON, err := apiClient.ContainerInspect(context.Background(), ctr.ID)
1517 1517
 	assert.NilError(c, err)
1518 1518
 
1519 1519
 	assert.Equal(c, containerJSON.HostConfig.ShmSize, int64(1073741824))
... ...
@@ -1532,14 +1532,14 @@ func (s *DockerAPISuite) TestPostContainersCreateMemorySwappinessHostConfigOmitt
1532 1532
 		Image: "busybox",
1533 1533
 	}
1534 1534
 
1535
-	cli, err := client.NewClientWithOpts(client.FromEnv)
1535
+	apiClient, err := client.NewClientWithOpts(client.FromEnv)
1536 1536
 	assert.NilError(c, err)
1537
-	defer cli.Close()
1537
+	defer apiClient.Close()
1538 1538
 
1539
-	container, err := cli.ContainerCreate(context.Background(), &config, &container.HostConfig{}, &network.NetworkingConfig{}, nil, "")
1539
+	ctr, err := apiClient.ContainerCreate(context.Background(), &config, &container.HostConfig{}, &network.NetworkingConfig{}, nil, "")
1540 1540
 	assert.NilError(c, err)
1541 1541
 
1542
-	containerJSON, err := cli.ContainerInspect(context.Background(), container.ID)
1542
+	containerJSON, err := apiClient.ContainerInspect(context.Background(), ctr.ID)
1543 1543
 	assert.NilError(c, err)
1544 1544
 
1545 1545
 	if versions.LessThan(testEnv.DaemonAPIVersion(), "1.31") {
... ...
@@ -1562,12 +1562,12 @@ func (s *DockerAPISuite) TestPostContainersCreateWithOomScoreAdjInvalidRange(c *
1562 1562
 		OomScoreAdj: 1001,
1563 1563
 	}
1564 1564
 
1565
-	cli, err := client.NewClientWithOpts(client.FromEnv)
1565
+	apiClient, err := client.NewClientWithOpts(client.FromEnv)
1566 1566
 	assert.NilError(c, err)
1567
-	defer cli.Close()
1567
+	defer apiClient.Close()
1568 1568
 
1569 1569
 	name := "oomscoreadj-over"
1570
-	_, err = cli.ContainerCreate(context.Background(), &config, &hostConfig, &network.NetworkingConfig{}, nil, name)
1570
+	_, err = apiClient.ContainerCreate(context.Background(), &config, &hostConfig, &network.NetworkingConfig{}, nil, name)
1571 1571
 
1572 1572
 	expected := "Invalid value 1001, range for oom score adj is [-1000, 1000]"
1573 1573
 	assert.ErrorContains(c, err, expected)
... ...
@@ -1577,7 +1577,7 @@ func (s *DockerAPISuite) TestPostContainersCreateWithOomScoreAdjInvalidRange(c *
1577 1577
 	}
1578 1578
 
1579 1579
 	name = "oomscoreadj-low"
1580
-	_, err = cli.ContainerCreate(context.Background(), &config, &hostConfig, &network.NetworkingConfig{}, nil, name)
1580
+	_, err = apiClient.ContainerCreate(context.Background(), &config, &hostConfig, &network.NetworkingConfig{}, nil, name)
1581 1581
 
1582 1582
 	expected = "Invalid value -1001, range for oom score adj is [-1000, 1000]"
1583 1583
 	assert.ErrorContains(c, err, expected)
... ...
@@ -1585,11 +1585,11 @@ func (s *DockerAPISuite) TestPostContainersCreateWithOomScoreAdjInvalidRange(c *
1585 1585
 
1586 1586
 // test case for #22210 where an empty container name caused panic.
1587 1587
 func (s *DockerAPISuite) TestContainerAPIDeleteWithEmptyName(c *testing.T) {
1588
-	cli, err := client.NewClientWithOpts(client.FromEnv)
1588
+	apiClient, err := client.NewClientWithOpts(client.FromEnv)
1589 1589
 	assert.NilError(c, err)
1590
-	defer cli.Close()
1590
+	defer apiClient.Close()
1591 1591
 
1592
-	err = cli.ContainerRemove(context.Background(), "", types.ContainerRemoveOptions{})
1592
+	err = apiClient.ContainerRemove(context.Background(), "", types.ContainerRemoveOptions{})
1593 1593
 	assert.Check(c, errdefs.IsNotFound(err))
1594 1594
 }
1595 1595
 
... ...
@@ -1605,14 +1605,14 @@ func (s *DockerAPISuite) TestContainerAPIStatsWithNetworkDisabled(c *testing.T)
1605 1605
 		NetworkDisabled: true,
1606 1606
 	}
1607 1607
 
1608
-	cli, err := client.NewClientWithOpts(client.FromEnv)
1608
+	apiClient, err := client.NewClientWithOpts(client.FromEnv)
1609 1609
 	assert.NilError(c, err)
1610
-	defer cli.Close()
1610
+	defer apiClient.Close()
1611 1611
 
1612
-	_, err = cli.ContainerCreate(context.Background(), &config, &container.HostConfig{}, &network.NetworkingConfig{}, nil, name)
1612
+	_, err = apiClient.ContainerCreate(context.Background(), &config, &container.HostConfig{}, &network.NetworkingConfig{}, nil, name)
1613 1613
 	assert.NilError(c, err)
1614 1614
 
1615
-	err = cli.ContainerStart(context.Background(), name, types.ContainerStartOptions{})
1615
+	err = apiClient.ContainerStart(context.Background(), name, types.ContainerStartOptions{})
1616 1616
 	assert.NilError(c, err)
1617 1617
 
1618 1618
 	assert.Assert(c, waitRun(name) == nil)
... ...
@@ -1623,7 +1623,7 @@ func (s *DockerAPISuite) TestContainerAPIStatsWithNetworkDisabled(c *testing.T)
1623 1623
 	}
1624 1624
 	bc := make(chan b, 1)
1625 1625
 	go func() {
1626
-		stats, err := cli.ContainerStats(context.Background(), name, false)
1626
+		stats, err := apiClient.ContainerStats(context.Background(), name, false)
1627 1627
 		bc <- b{stats, err}
1628 1628
 	}()
1629 1629
 
... ...
@@ -1953,11 +1953,11 @@ func (s *DockerAPISuite) TestContainerAPICreateMountsBindRead(c *testing.T) {
1953 1953
 			{Type: "bind", Source: tmpDir, Target: destPath},
1954 1954
 		},
1955 1955
 	}
1956
-	cli, err := client.NewClientWithOpts(client.FromEnv)
1956
+	apiClient, err := client.NewClientWithOpts(client.FromEnv)
1957 1957
 	assert.NilError(c, err)
1958
-	defer cli.Close()
1958
+	defer apiClient.Close()
1959 1959
 
1960
-	_, err = cli.ContainerCreate(context.Background(), &config, &hostConfig, &network.NetworkingConfig{}, nil, "test")
1960
+	_, err = apiClient.ContainerCreate(context.Background(), &config, &hostConfig, &network.NetworkingConfig{}, nil, "test")
1961 1961
 	assert.NilError(c, err)
1962 1962
 
1963 1963
 	out, _ := dockerCmd(c, "start", "-a", "test")
... ...
@@ -2099,7 +2099,7 @@ func (s *DockerAPISuite) TestContainersAPICreateMountsCreate(c *testing.T) {
2099 2099
 	for i, x := range cases {
2100 2100
 		x := x
2101 2101
 		c.Run(fmt.Sprintf("%d config: %v", i, x.spec), func(c *testing.T) {
2102
-			container, err := apiclient.ContainerCreate(
2102
+			ctr, err := apiclient.ContainerCreate(
2103 2103
 				ctx,
2104 2104
 				&container.Config{Image: testImg},
2105 2105
 				&container.HostConfig{Mounts: []mount.Mount{x.spec}},
... ...
@@ -2108,7 +2108,7 @@ func (s *DockerAPISuite) TestContainersAPICreateMountsCreate(c *testing.T) {
2108 2108
 				"")
2109 2109
 			assert.NilError(c, err)
2110 2110
 
2111
-			containerInspect, err := apiclient.ContainerInspect(ctx, container.ID)
2111
+			containerInspect, err := apiclient.ContainerInspect(ctx, ctr.ID)
2112 2112
 			assert.NilError(c, err)
2113 2113
 			mps := containerInspect.Mounts
2114 2114
 			assert.Assert(c, is.Len(mps, 1))
... ...
@@ -2131,11 +2131,11 @@ func (s *DockerAPISuite) TestContainersAPICreateMountsCreate(c *testing.T) {
2131 2131
 			assert.Check(c, is.Equal(x.expected.Mode, mountPoint.Mode))
2132 2132
 			assert.Check(c, is.Equal(x.expected.Destination, mountPoint.Destination))
2133 2133
 
2134
-			err = apiclient.ContainerStart(ctx, container.ID, types.ContainerStartOptions{})
2134
+			err = apiclient.ContainerStart(ctx, ctr.ID, types.ContainerStartOptions{})
2135 2135
 			assert.NilError(c, err)
2136
-			poll.WaitOn(c, containerExit(apiclient, container.ID), poll.WithDelay(time.Second))
2136
+			poll.WaitOn(c, containerExit(apiclient, ctr.ID), poll.WithDelay(time.Second))
2137 2137
 
2138
-			err = apiclient.ContainerRemove(ctx, container.ID, types.ContainerRemoveOptions{
2138
+			err = apiclient.ContainerRemove(ctx, ctr.ID, types.ContainerRemoveOptions{
2139 2139
 				RemoveVolumes: true,
2140 2140
 				Force:         true,
2141 2141
 			})
... ...
@@ -2161,13 +2161,13 @@ func (s *DockerAPISuite) TestContainersAPICreateMountsCreate(c *testing.T) {
2161 2161
 
2162 2162
 func containerExit(apiclient client.APIClient, name string) func(poll.LogT) poll.Result {
2163 2163
 	return func(logT poll.LogT) poll.Result {
2164
-		container, err := apiclient.ContainerInspect(context.Background(), name)
2164
+		ctr, err := apiclient.ContainerInspect(context.Background(), name)
2165 2165
 		if err != nil {
2166 2166
 			return poll.Error(err)
2167 2167
 		}
2168
-		switch container.State.Status {
2168
+		switch ctr.State.Status {
2169 2169
 		case "created", "running":
2170
-			return poll.Continue("container %s is %s, waiting for exit", name, container.State.Status)
2170
+			return poll.Continue("container %s is %s, waiting for exit", name, ctr.State.Status)
2171 2171
 		}
2172 2172
 		return poll.Success()
2173 2173
 	}
... ...
@@ -2197,9 +2197,9 @@ func (s *DockerAPISuite) TestContainersAPICreateMountsTmpfs(c *testing.T) {
2197 2197
 		},
2198 2198
 	}
2199 2199
 
2200
-	cli, err := client.NewClientWithOpts(client.FromEnv)
2200
+	apiClient, err := client.NewClientWithOpts(client.FromEnv)
2201 2201
 	assert.NilError(c, err)
2202
-	defer cli.Close()
2202
+	defer apiClient.Close()
2203 2203
 
2204 2204
 	config := container.Config{
2205 2205
 		Image: "busybox",
... ...
@@ -2211,7 +2211,7 @@ func (s *DockerAPISuite) TestContainersAPICreateMountsTmpfs(c *testing.T) {
2211 2211
 			Mounts: []mount.Mount{x.cfg},
2212 2212
 		}
2213 2213
 
2214
-		_, err = cli.ContainerCreate(context.Background(), &config, &hostConfig, &network.NetworkingConfig{}, nil, cName)
2214
+		_, err = apiClient.ContainerCreate(context.Background(), &config, &hostConfig, &network.NetworkingConfig{}, nil, cName)
2215 2215
 		assert.NilError(c, err)
2216 2216
 		out, _ := dockerCmd(c, "start", "-a", cName)
2217 2217
 		for _, option := range x.expectedOptions {
... ...
@@ -68,14 +68,14 @@ func (s *DockerAPISuite) TestExecAPICreateContainerPaused(c *testing.T) {
68 68
 
69 69
 	dockerCmd(c, "pause", name)
70 70
 
71
-	cli, err := client.NewClientWithOpts(client.FromEnv)
71
+	apiClient, err := client.NewClientWithOpts(client.FromEnv)
72 72
 	assert.NilError(c, err)
73
-	defer cli.Close()
73
+	defer apiClient.Close()
74 74
 
75 75
 	config := types.ExecConfig{
76 76
 		Cmd: []string{"true"},
77 77
 	}
78
-	_, err = cli.ContainerExecCreate(context.Background(), name, config)
78
+	_, err = apiClient.ContainerExecCreate(context.Background(), name, config)
79 79
 	assert.ErrorContains(c, err, "Container "+name+" is paused, unpause the container before exec", "Expected message when creating exec command with Container %s is paused", name)
80 80
 }
81 81
 
... ...
@@ -150,11 +150,11 @@ func (s *DockerAPISuite) TestExecAPIStartWithDetach(c *testing.T) {
150 150
 		AttachStderr: true,
151 151
 	}
152 152
 
153
-	cli, err := client.NewClientWithOpts(client.FromEnv)
153
+	apiClient, err := client.NewClientWithOpts(client.FromEnv)
154 154
 	assert.NilError(c, err)
155
-	defer cli.Close()
155
+	defer apiClient.Close()
156 156
 
157
-	createResp, err := cli.ContainerExecCreate(context.Background(), name, config)
157
+	createResp, err := apiClient.ContainerExecCreate(context.Background(), name, config)
158 158
 	assert.NilError(c, err)
159 159
 
160 160
 	_, body, err := request.Post(fmt.Sprintf("/exec/%s/start", createResp.ID), request.RawString(`{"Detach": true}`), request.JSON)
... ...
@@ -17,9 +17,9 @@ import (
17 17
 )
18 18
 
19 19
 func (s *DockerAPISuite) TestAPIImagesFilter(c *testing.T) {
20
-	cli, err := client.NewClientWithOpts(client.FromEnv)
20
+	apiClient, err := client.NewClientWithOpts(client.FromEnv)
21 21
 	assert.NilError(c, err)
22
-	defer cli.Close()
22
+	defer apiClient.Close()
23 23
 
24 24
 	name := "utest:tag1"
25 25
 	name2 := "utest/docker:tag2"
... ...
@@ -28,13 +28,13 @@ func (s *DockerAPISuite) TestAPIImagesFilter(c *testing.T) {
28 28
 		dockerCmd(c, "tag", "busybox", n)
29 29
 	}
30 30
 	getImages := func(filter string) []types.ImageSummary {
31
-		filters := filters.NewArgs()
32
-		filters.Add("reference", filter)
31
+		fltrs := filters.NewArgs()
32
+		fltrs.Add("reference", filter)
33 33
 		options := types.ImageListOptions{
34 34
 			All:     false,
35
-			Filters: filters,
35
+			Filters: fltrs,
36 36
 		}
37
-		images, err := cli.ImageList(context.Background(), options)
37
+		images, err := apiClient.ImageList(context.Background(), options)
38 38
 		assert.NilError(c, err)
39 39
 
40 40
 		return images
... ...
@@ -76,9 +76,9 @@ func (s *DockerAPISuite) TestAPIImagesSaveAndLoad(c *testing.T) {
76 76
 }
77 77
 
78 78
 func (s *DockerAPISuite) TestAPIImagesDelete(c *testing.T) {
79
-	cli, err := client.NewClientWithOpts(client.FromEnv)
79
+	apiClient, err := client.NewClientWithOpts(client.FromEnv)
80 80
 	assert.NilError(c, err)
81
-	defer cli.Close()
81
+	defer apiClient.Close()
82 82
 
83 83
 	if testEnv.OSType != "windows" {
84 84
 		testRequires(c, Network)
... ...
@@ -89,20 +89,20 @@ func (s *DockerAPISuite) TestAPIImagesDelete(c *testing.T) {
89 89
 
90 90
 	dockerCmd(c, "tag", name, "test:tag1")
91 91
 
92
-	_, err = cli.ImageRemove(context.Background(), id, types.ImageRemoveOptions{})
92
+	_, err = apiClient.ImageRemove(context.Background(), id, types.ImageRemoveOptions{})
93 93
 	assert.ErrorContains(c, err, "unable to delete")
94 94
 
95
-	_, err = cli.ImageRemove(context.Background(), "test:noexist", types.ImageRemoveOptions{})
95
+	_, err = apiClient.ImageRemove(context.Background(), "test:noexist", types.ImageRemoveOptions{})
96 96
 	assert.ErrorContains(c, err, "No such image")
97 97
 
98
-	_, err = cli.ImageRemove(context.Background(), "test:tag1", types.ImageRemoveOptions{})
98
+	_, err = apiClient.ImageRemove(context.Background(), "test:tag1", types.ImageRemoveOptions{})
99 99
 	assert.NilError(c, err)
100 100
 }
101 101
 
102 102
 func (s *DockerAPISuite) TestAPIImagesHistory(c *testing.T) {
103
-	cli, err := client.NewClientWithOpts(client.FromEnv)
103
+	apiClient, err := client.NewClientWithOpts(client.FromEnv)
104 104
 	assert.NilError(c, err)
105
-	defer cli.Close()
105
+	defer apiClient.Close()
106 106
 
107 107
 	if testEnv.OSType != "windows" {
108 108
 		testRequires(c, Network)
... ...
@@ -111,7 +111,7 @@ func (s *DockerAPISuite) TestAPIImagesHistory(c *testing.T) {
111 111
 	buildImageSuccessfully(c, name, build.WithDockerfile("FROM busybox\nENV FOO bar"))
112 112
 	id := getIDByName(c, name)
113 113
 
114
-	historydata, err := cli.ImageHistory(context.Background(), id)
114
+	historydata, err := apiClient.ImageHistory(context.Background(), id)
115 115
 	assert.NilError(c, err)
116 116
 
117 117
 	assert.Assert(c, len(historydata) != 0)
... ...
@@ -105,11 +105,11 @@ func (s *DockerAPISuite) TestInspectAPIContainerVolumeDriver(c *testing.T) {
105 105
 
106 106
 func (s *DockerAPISuite) TestInspectAPIImageResponse(c *testing.T) {
107 107
 	dockerCmd(c, "tag", "busybox:latest", "busybox:mytag")
108
-	cli, err := client.NewClientWithOpts(client.FromEnv)
108
+	apiClient, err := client.NewClientWithOpts(client.FromEnv)
109 109
 	assert.NilError(c, err)
110
-	defer cli.Close()
110
+	defer apiClient.Close()
111 111
 
112
-	imageJSON, _, err := cli.ImageInspectWithRaw(context.Background(), "busybox")
112
+	imageJSON, _, err := apiClient.ImageInspectWithRaw(context.Background(), "busybox")
113 113
 	assert.NilError(c, err)
114 114
 
115 115
 	assert.Check(c, len(imageJSON.RepoTags) == 2)
... ...
@@ -58,11 +58,11 @@ func (s *DockerAPISuite) TestLogsAPIWithStdout(c *testing.T) {
58 58
 func (s *DockerAPISuite) TestLogsAPINoStdoutNorStderr(c *testing.T) {
59 59
 	name := "logs_test"
60 60
 	dockerCmd(c, "run", "-d", "-t", "--name", name, "busybox", "/bin/sh")
61
-	cli, err := client.NewClientWithOpts(client.FromEnv)
61
+	apiClient, err := client.NewClientWithOpts(client.FromEnv)
62 62
 	assert.NilError(c, err)
63
-	defer cli.Close()
63
+	defer apiClient.Close()
64 64
 
65
-	_, err = cli.ContainerLogs(context.Background(), name, types.ContainerLogsOptions{})
65
+	_, err = apiClient.ContainerLogs(context.Background(), name, types.ContainerLogsOptions{})
66 66
 	assert.ErrorContains(c, err, "Bad parameters: you must choose at least one stream")
67 67
 }
68 68
 
... ...
@@ -262,15 +262,15 @@ func jsonBlobHasGTE121NetworkStats(blob map[string]interface{}) bool {
262 262
 
263 263
 func (s *DockerAPISuite) TestAPIStatsContainerNotFound(c *testing.T) {
264 264
 	testRequires(c, DaemonIsLinux)
265
-	cli, err := client.NewClientWithOpts(client.FromEnv)
265
+	apiClient, err := client.NewClientWithOpts(client.FromEnv)
266 266
 	assert.NilError(c, err)
267
-	defer cli.Close()
267
+	defer apiClient.Close()
268 268
 
269 269
 	expected := "No such container: nonexistent"
270 270
 
271
-	_, err = cli.ContainerStats(context.Background(), "nonexistent", true)
271
+	_, err = apiClient.ContainerStats(context.Background(), "nonexistent", true)
272 272
 	assert.ErrorContains(c, err, expected)
273
-	_, err = cli.ContainerStats(context.Background(), "nonexistent", false)
273
+	_, err = apiClient.ContainerStats(context.Background(), "nonexistent", false)
274 274
 	assert.ErrorContains(c, err, expected)
275 275
 }
276 276
 
... ...
@@ -454,15 +454,15 @@ func (s *DockerCLIEventSuite) TestEventsResize(c *testing.T) {
454 454
 	cID := strings.TrimSpace(out)
455 455
 	assert.NilError(c, waitRun(cID))
456 456
 
457
-	cli, err := client.NewClientWithOpts(client.FromEnv)
457
+	apiClient, err := client.NewClientWithOpts(client.FromEnv)
458 458
 	assert.NilError(c, err)
459
-	defer cli.Close()
459
+	defer apiClient.Close()
460 460
 
461 461
 	options := types.ResizeOptions{
462 462
 		Height: 80,
463 463
 		Width:  24,
464 464
 	}
465
-	err = cli.ContainerResize(context.Background(), cID, options)
465
+	err = apiClient.ContainerResize(context.Background(), cID, options)
466 466
 	assert.NilError(c, err)
467 467
 
468 468
 	dockerCmd(c, "stop", cID)
... ...
@@ -359,11 +359,11 @@ func (s *DockerCLIExecSuite) TestExecInspectID(c *testing.T) {
359 359
 	}
360 360
 
361 361
 	// But we should still be able to query the execID
362
-	cli, err := client.NewClientWithOpts(client.FromEnv)
362
+	apiClient, err := client.NewClientWithOpts(client.FromEnv)
363 363
 	assert.NilError(c, err)
364
-	defer cli.Close()
364
+	defer apiClient.Close()
365 365
 
366
-	_, err = cli.ContainerExecInspect(context.Background(), execID)
366
+	_, err = apiClient.ContainerExecInspect(context.Background(), execID)
367 367
 	assert.NilError(c, err)
368 368
 
369 369
 	// Now delete the container and then an 'inspect' on the exec should
... ...
@@ -371,7 +371,7 @@ func (s *DockerCLIExecSuite) TestExecInspectID(c *testing.T) {
371 371
 	out, ec := dockerCmd(c, "rm", "-f", id)
372 372
 	assert.Equal(c, ec, 0, "error removing container: %s", out)
373 373
 
374
-	_, err = cli.ContainerExecInspect(context.Background(), execID)
374
+	_, err = apiClient.ContainerExecInspect(context.Background(), execID)
375 375
 	assert.ErrorContains(c, err, "No such exec instance")
376 376
 }
377 377
 
... ...
@@ -19,10 +19,10 @@ func (s *DockerCLIInfoSuite) TestInfoSecurityOptions(c *testing.T) {
19 19
 		c.Skip("test requires Seccomp and/or AppArmor")
20 20
 	}
21 21
 
22
-	cli, err := client.NewClientWithOpts(client.FromEnv)
22
+	apiClient, err := client.NewClientWithOpts(client.FromEnv)
23 23
 	assert.NilError(c, err)
24
-	defer cli.Close()
25
-	info, err := cli.Info(context.Background())
24
+	defer apiClient.Close()
25
+	info, err := apiClient.Info(context.Background())
26 26
 	assert.NilError(c, err)
27 27
 
28 28
 	if Apparmor() {
... ...
@@ -47,11 +47,11 @@ func (s *DockerCLIPluginLogDriverSuite) TestPluginLogDriverInfoList(c *testing.T
47 47
 
48 48
 	dockerCmd(c, "plugin", "install", pluginName)
49 49
 
50
-	cli, err := client.NewClientWithOpts(client.FromEnv)
50
+	apiClient, err := client.NewClientWithOpts(client.FromEnv)
51 51
 	assert.NilError(c, err)
52
-	defer cli.Close()
52
+	defer apiClient.Close()
53 53
 
54
-	info, err := cli.Info(context.Background())
54
+	info, err := apiClient.Info(context.Background())
55 55
 	assert.NilError(c, err)
56 56
 
57 57
 	drivers := strings.Join(info.Plugins.Log, " ")
... ...
@@ -3791,11 +3791,11 @@ func (s *DockerCLIRunSuite) TestRunNamedVolumesFromNotRemoved(c *testing.T) {
3791 3791
 	cid, _ := dockerCmd(c, "run", "-d", "--name=parent", "-v", "test:"+prefix+"/foo", "-v", prefix+"/bar", "busybox", "true")
3792 3792
 	dockerCmd(c, "run", "--name=child", "--volumes-from=parent", "busybox", "true")
3793 3793
 
3794
-	cli, err := client.NewClientWithOpts(client.FromEnv)
3794
+	apiClient, err := client.NewClientWithOpts(client.FromEnv)
3795 3795
 	assert.NilError(c, err)
3796
-	defer cli.Close()
3796
+	defer apiClient.Close()
3797 3797
 
3798
-	container, err := cli.ContainerInspect(context.Background(), strings.TrimSpace(cid))
3798
+	container, err := apiClient.ContainerInspect(context.Background(), strings.TrimSpace(cid))
3799 3799
 	assert.NilError(c, err)
3800 3800
 	var vname string
3801 3801
 	for _, v := range container.Mounts {
... ...
@@ -570,9 +570,9 @@ func (s *DockerCLIVolumeSuite) TestDuplicateMountpointsForVolumesFromAndMounts(c
570 570
 	err := os.MkdirAll("/tmp/data", 0755)
571 571
 	assert.NilError(c, err)
572 572
 	// Mounts is available in API
573
-	cli, err := client.NewClientWithOpts(client.FromEnv)
573
+	apiClient, err := client.NewClientWithOpts(client.FromEnv)
574 574
 	assert.NilError(c, err)
575
-	defer cli.Close()
575
+	defer apiClient.Close()
576 576
 
577 577
 	config := container.Config{
578 578
 		Cmd:   []string{"top"},
... ...
@@ -589,7 +589,7 @@ func (s *DockerCLIVolumeSuite) TestDuplicateMountpointsForVolumesFromAndMounts(c
589 589
 			},
590 590
 		},
591 591
 	}
592
-	_, err = cli.ContainerCreate(context.Background(), &config, &hostConfig, &network.NetworkingConfig{}, nil, "app")
592
+	_, err = apiClient.ContainerCreate(context.Background(), &config, &hostConfig, &network.NetworkingConfig{}, nil, "app")
593 593
 
594 594
 	assert.NilError(c, err)
595 595
 
... ...
@@ -245,11 +245,11 @@ func daemonTime(c *testing.T) time.Time {
245 245
 	if testEnv.IsLocalDaemon() {
246 246
 		return time.Now()
247 247
 	}
248
-	cli, err := client.NewClientWithOpts(client.FromEnv)
248
+	apiClient, err := client.NewClientWithOpts(client.FromEnv)
249 249
 	assert.NilError(c, err)
250
-	defer cli.Close()
250
+	defer apiClient.Close()
251 251
 
252
-	info, err := cli.Info(context.Background())
252
+	info, err := apiClient.Info(context.Background())
253 253
 	assert.NilError(c, err)
254 254
 
255 255
 	dt, err := time.Parse(time.RFC3339Nano, info.SystemTime)
... ...
@@ -324,10 +324,10 @@ func waitInspect(name, expr, expected string, timeout time.Duration) error {
324 324
 
325 325
 func getInspectBody(c *testing.T, version, id string) []byte {
326 326
 	c.Helper()
327
-	cli, err := client.NewClientWithOpts(client.FromEnv, client.WithVersion(version))
327
+	apiClient, err := client.NewClientWithOpts(client.FromEnv, client.WithVersion(version))
328 328
 	assert.NilError(c, err)
329
-	defer cli.Close()
330
-	_, body, err := cli.ContainerInspectWithRaw(context.Background(), id, false)
329
+	defer apiClient.Close()
330
+	_, body, err := apiClient.ContainerInspectWithRaw(context.Background(), id, false)
331 331
 	assert.NilError(c, err)
332 332
 	return body
333 333
 }
... ...
@@ -357,13 +357,13 @@ func minimalBaseImage() string {
357 357
 }
358 358
 
359 359
 func getGoroutineNumber() (int, error) {
360
-	cli, err := client.NewClientWithOpts(client.FromEnv)
360
+	apiClient, err := client.NewClientWithOpts(client.FromEnv)
361 361
 	if err != nil {
362 362
 		return 0, err
363 363
 	}
364
-	defer cli.Close()
364
+	defer apiClient.Close()
365 365
 
366
-	info, err := cli.Info(context.Background())
366
+	info, err := apiClient.Info(context.Background())
367 367
 	if err != nil {
368 368
 		return 0, err
369 369
 	}
... ...
@@ -38,11 +38,11 @@ func MinimumAPIVersion(version string) func() bool {
38 38
 }
39 39
 
40 40
 func OnlyDefaultNetworks() bool {
41
-	cli, err := client.NewClientWithOpts(client.FromEnv)
41
+	apiClient, err := client.NewClientWithOpts(client.FromEnv)
42 42
 	if err != nil {
43 43
 		return false
44 44
 	}
45
-	networks, err := cli.NetworkList(context.TODO(), types.NetworkListOptions{})
45
+	networks, err := apiClient.NetworkList(context.TODO(), types.NetworkListOptions{})
46 46
 	if err != nil || len(networks) > 0 {
47 47
 		return false
48 48
 	}
... ...
@@ -78,11 +78,11 @@ func Network() bool {
78 78
 	const timeout = 15 * time.Second
79 79
 	const url = "https://hub.docker.com"
80 80
 
81
-	client := http.Client{
81
+	c := http.Client{
82 82
 		Timeout: timeout,
83 83
 	}
84 84
 
85
-	resp, err := client.Get(url)
85
+	resp, err := c.Get(url)
86 86
 	if err != nil && strings.Contains(err.Error(), "use of closed network connection") {
87 87
 		panic(fmt.Sprintf("Timeout for GET request on %s", url))
88 88
 	}