Browse code

integration-cli: DockerDaemonSuite: replace dockerCmd

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

Sebastiaan van Stijn authored on 2023/07/28 06:30:40
Showing 1 changed files
... ...
@@ -1267,7 +1267,7 @@ func pingContainers(c *testing.T, d *daemon.Daemon, expectFailure bool) {
1267 1267
 	}
1268 1268
 
1269 1269
 	args := append(dargs, "run", "-d", "--name", "container1", "busybox", "top")
1270
-	dockerCmd(c, args...)
1270
+	cli.DockerCmd(c, args...)
1271 1271
 
1272 1272
 	args = append(dargs, "run", "--rm", "--link", "container1:alias1", "busybox", "sh", "-c")
1273 1273
 	pingCmd := "ping -c 1 %s -W 1"
... ...
@@ -1281,7 +1281,7 @@ func pingContainers(c *testing.T, d *daemon.Daemon, expectFailure bool) {
1281 1281
 	}
1282 1282
 
1283 1283
 	args = append(dargs, "rm", "-f", "container1")
1284
-	dockerCmd(c, args...)
1284
+	cli.DockerCmd(c, args...)
1285 1285
 }
1286 1286
 
1287 1287
 func (s *DockerDaemonSuite) TestDaemonRestartWithSocketAsVolume(c *testing.T) {
... ...
@@ -1549,14 +1549,13 @@ func (s *DockerDaemonSuite) TestDaemonStartWithDefaultTLSHost(c *testing.T) {
1549 1549
 	// The client with --tlsverify should also use default host localhost:2376
1550 1550
 	c.Setenv("DOCKER_HOST", "")
1551 1551
 
1552
-	out, _ := dockerCmd(
1553
-		c,
1552
+	out := cli.DockerCmd(c,
1554 1553
 		"--tlsverify",
1555 1554
 		"--tlscacert", "fixtures/https/ca.pem",
1556 1555
 		"--tlscert", "fixtures/https/client-cert.pem",
1557 1556
 		"--tlskey", "fixtures/https/client-key.pem",
1558 1557
 		"version",
1559
-	)
1558
+	).Stdout()
1560 1559
 	if !strings.Contains(out, "Server") {
1561 1560
 		c.Fatalf("docker version should return information of server side")
1562 1561
 	}
... ...
@@ -1627,10 +1626,10 @@ func (s *DockerDaemonSuite) TestDaemonNoSpaceLeftOnDeviceError(c *testing.T) {
1627 1627
 
1628 1628
 	// create a 3MiB image (with a 2MiB ext4 fs) and mount it as graph root
1629 1629
 	// Why in a container? Because `mount` sometimes behaves weirdly and often fails outright on this test in debian:bullseye (which is what the test suite runs under if run from the Makefile)
1630
-	dockerCmd(c, "run", "--rm", "-v", testDir+":/test", "busybox", "sh", "-c", "dd of=/test/testfs.img bs=1M seek=3 count=0")
1630
+	cli.DockerCmd(c, "run", "--rm", "-v", testDir+":/test", "busybox", "sh", "-c", "dd of=/test/testfs.img bs=1M seek=3 count=0")
1631 1631
 	icmd.RunCommand("mkfs.ext4", "-F", filepath.Join(testDir, "testfs.img")).Assert(c, icmd.Success)
1632 1632
 
1633
-	dockerCmd(c, "run", "--privileged", "--rm", "-v", testDir+":/test:shared", "busybox", "sh", "-c", "mkdir -p /test/test-mount && mount -n -t ext4 /test/testfs.img /test/test-mount")
1633
+	cli.DockerCmd(c, "run", "--privileged", "--rm", "-v", testDir+":/test:shared", "busybox", "sh", "-c", "mkdir -p /test/test-mount && mount -n -t ext4 /test/testfs.img /test/test-mount")
1634 1634
 	defer mount.Unmount(filepath.Join(testDir, "test-mount"))
1635 1635
 
1636 1636
 	driver := "vfs"
... ...
@@ -1732,8 +1731,8 @@ func (s *DockerDaemonSuite) TestDaemonCgroupParent(c *testing.T) {
1732 1732
 	id := strings.TrimSpace(out)
1733 1733
 	expectedCgroup := path.Join(cgroupParent, id)
1734 1734
 	found := false
1735
-	for _, path := range cgroupPaths {
1736
-		if strings.HasSuffix(path, expectedCgroup) {
1735
+	for _, p := range cgroupPaths {
1736
+		if strings.HasSuffix(p, expectedCgroup) {
1737 1737
 			found = true
1738 1738
 			break
1739 1739
 		}
... ...
@@ -2768,13 +2767,13 @@ func (s *DockerDaemonSuite) TestFailedPluginRemove(c *testing.T) {
2768 2768
 	testRequires(c, DaemonIsLinux, IsAmd64, testEnv.IsLocalDaemon)
2769 2769
 	d := daemon.New(c, dockerBinary, dockerdBinary)
2770 2770
 	d.Start(c)
2771
-	cli := d.NewClientT(c)
2771
+	apiClient := d.NewClientT(c)
2772 2772
 
2773 2773
 	ctx, cancel := context.WithTimeout(testutil.GetContext(c), 300*time.Second)
2774 2774
 	defer cancel()
2775 2775
 
2776 2776
 	name := "test-plugin-rm-fail"
2777
-	out, err := cli.PluginInstall(ctx, name, types.PluginInstallOptions{
2777
+	out, err := apiClient.PluginInstall(ctx, name, types.PluginInstallOptions{
2778 2778
 		Disabled:             true,
2779 2779
 		AcceptAllPermissions: true,
2780 2780
 		RemoteRef:            "cpuguy83/docker-logdriver-test",
... ...
@@ -2785,7 +2784,7 @@ func (s *DockerDaemonSuite) TestFailedPluginRemove(c *testing.T) {
2785 2785
 
2786 2786
 	ctx, cancel = context.WithTimeout(testutil.GetContext(c), 30*time.Second)
2787 2787
 	defer cancel()
2788
-	p, _, err := cli.PluginInspectWithRaw(ctx, name)
2788
+	p, _, err := apiClient.PluginInspectWithRaw(ctx, name)
2789 2789
 	assert.NilError(c, err)
2790 2790
 
2791 2791
 	// simulate a bad/partial removal by removing the plugin config.
... ...
@@ -2795,10 +2794,10 @@ func (s *DockerDaemonSuite) TestFailedPluginRemove(c *testing.T) {
2795 2795
 	d.Restart(c)
2796 2796
 	ctx, cancel = context.WithTimeout(testutil.GetContext(c), 30*time.Second)
2797 2797
 	defer cancel()
2798
-	_, err = cli.Ping(ctx)
2798
+	_, err = apiClient.Ping(ctx)
2799 2799
 	assert.NilError(c, err)
2800 2800
 
2801
-	_, _, err = cli.PluginInspectWithRaw(ctx, name)
2801
+	_, _, err = apiClient.PluginInspectWithRaw(ctx, name)
2802 2802
 	// plugin should be gone since the config.json is gone
2803 2803
 	assert.ErrorContains(c, err, "")
2804 2804
 }