Browse code

integration-cli: DockerCLIExecSuite: replace dockerCmd and waitRun

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

Sebastiaan van Stijn authored on 2023/07/27 20:32:46
Showing 2 changed files
... ...
@@ -37,16 +37,16 @@ func (s *DockerCLIExecSuite) OnTimeout(c *testing.T) {
37 37
 
38 38
 func (s *DockerCLIExecSuite) TestExec(c *testing.T) {
39 39
 	testRequires(c, DaemonIsLinux)
40
-	out, _ := dockerCmd(c, "run", "-d", "--name", "testing", "busybox", "sh", "-c", "echo test > /tmp/file && top")
41
-	assert.NilError(c, waitRun(strings.TrimSpace(out)))
40
+	out := cli.DockerCmd(c, "run", "-d", "--name", "testing", "busybox", "sh", "-c", "echo test > /tmp/file && top").Stdout()
41
+	cli.WaitRun(c, strings.TrimSpace(out))
42 42
 
43
-	out, _ = dockerCmd(c, "exec", "testing", "cat", "/tmp/file")
43
+	out = cli.DockerCmd(c, "exec", "testing", "cat", "/tmp/file").Stdout()
44 44
 	assert.Equal(c, strings.Trim(out, "\r\n"), "test")
45 45
 }
46 46
 
47 47
 func (s *DockerCLIExecSuite) TestExecInteractive(c *testing.T) {
48 48
 	testRequires(c, DaemonIsLinux)
49
-	dockerCmd(c, "run", "-d", "--name", "testing", "busybox", "sh", "-c", "echo test > /tmp/file && top")
49
+	cli.DockerCmd(c, "run", "-d", "--name", "testing", "busybox", "sh", "-c", "echo test > /tmp/file && top")
50 50
 
51 51
 	execCmd := exec.Command(dockerBinary, "exec", "-i", "testing", "sh")
52 52
 	stdin, err := execCmd.StdinPipe()
... ...
@@ -80,13 +80,12 @@ func (s *DockerCLIExecSuite) TestExecInteractive(c *testing.T) {
80 80
 }
81 81
 
82 82
 func (s *DockerCLIExecSuite) TestExecAfterContainerRestart(c *testing.T) {
83
-	out := runSleepingContainer(c)
84
-	cleanedContainerID := strings.TrimSpace(out)
85
-	assert.NilError(c, waitRun(cleanedContainerID))
86
-	dockerCmd(c, "restart", cleanedContainerID)
87
-	assert.NilError(c, waitRun(cleanedContainerID))
83
+	cID := runSleepingContainer(c)
84
+	cli.WaitRun(c, cID)
85
+	cli.DockerCmd(c, "restart", cID)
86
+	cli.WaitRun(c, cID)
88 87
 
89
-	out, _ = dockerCmd(c, "exec", cleanedContainerID, "echo", "hello")
88
+	out := cli.DockerCmd(c, "exec", cID, "echo", "hello").Combined()
90 89
 	assert.Equal(c, strings.TrimSpace(out), "hello")
91 90
 }
92 91
 
... ...
@@ -116,9 +115,9 @@ func (s *DockerCLIExecSuite) TestExecEnv(c *testing.T) {
116 116
 	// a subsequent exec will not have LALA set/
117 117
 	testRequires(c, DaemonIsLinux)
118 118
 	runSleepingContainer(c, "-e", "LALA=value1", "-e", "LALA=value2", "-d", "--name", "testing")
119
-	assert.NilError(c, waitRun("testing"))
119
+	cli.WaitRun(c, "testing")
120 120
 
121
-	out, _ := dockerCmd(c, "exec", "testing", "env")
121
+	out := cli.DockerCmd(c, "exec", "testing", "env").Stdout()
122 122
 	assert.Check(c, !strings.Contains(out, "LALA=value1"))
123 123
 	assert.Check(c, strings.Contains(out, "LALA=value2"))
124 124
 	assert.Check(c, strings.Contains(out, "HOME=/root"))
... ...
@@ -127,9 +126,9 @@ func (s *DockerCLIExecSuite) TestExecEnv(c *testing.T) {
127 127
 func (s *DockerCLIExecSuite) TestExecSetEnv(c *testing.T) {
128 128
 	testRequires(c, DaemonIsLinux)
129 129
 	runSleepingContainer(c, "-e", "HOME=/root", "-d", "--name", "testing")
130
-	assert.NilError(c, waitRun("testing"))
130
+	cli.WaitRun(c, "testing")
131 131
 
132
-	out, _ := dockerCmd(c, "exec", "-e", "HOME=/another", "-e", "ABC=xyz", "testing", "env")
132
+	out := cli.DockerCmd(c, "exec", "-e", "HOME=/another", "-e", "ABC=xyz", "testing", "env").Stdout()
133 133
 	assert.Check(c, !strings.Contains(out, "HOME=/root"))
134 134
 	assert.Check(c, strings.Contains(out, "HOME=/another"))
135 135
 	assert.Check(c, strings.Contains(out, "ABC=xyz"))
... ...
@@ -145,10 +144,9 @@ func (s *DockerCLIExecSuite) TestExecExitStatus(c *testing.T) {
145 145
 func (s *DockerCLIExecSuite) TestExecPausedContainer(c *testing.T) {
146 146
 	testRequires(c, IsPausable)
147 147
 
148
-	out := runSleepingContainer(c, "-d", "--name", "testing")
149
-	ContainerID := strings.TrimSpace(out)
148
+	ContainerID := runSleepingContainer(c, "-d", "--name", "testing")
150 149
 
151
-	dockerCmd(c, "pause", "testing")
150
+	cli.DockerCmd(c, "pause", "testing")
152 151
 	out, _, err := dockerCmdWithError("exec", ContainerID, "echo", "hello")
153 152
 	assert.ErrorContains(c, err, "", "container should fail to exec new command if it is paused")
154 153
 
... ...
@@ -160,7 +158,7 @@ func (s *DockerCLIExecSuite) TestExecPausedContainer(c *testing.T) {
160 160
 func (s *DockerCLIExecSuite) TestExecTTYCloseStdin(c *testing.T) {
161 161
 	// TODO Windows CI: This requires some work to port to Windows.
162 162
 	testRequires(c, DaemonIsLinux)
163
-	dockerCmd(c, "run", "-d", "-it", "--name", "exec_tty_stdin", "busybox")
163
+	cli.DockerCmd(c, "run", "-d", "-it", "--name", "exec_tty_stdin", "busybox")
164 164
 
165 165
 	cmd := exec.Command(dockerBinary, "exec", "-i", "exec_tty_stdin", "cat")
166 166
 	stdinRw, err := cmd.StdinPipe()
... ...
@@ -172,16 +170,16 @@ func (s *DockerCLIExecSuite) TestExecTTYCloseStdin(c *testing.T) {
172 172
 	out, _, err := runCommandWithOutput(cmd)
173 173
 	assert.NilError(c, err, out)
174 174
 
175
-	out, _ = dockerCmd(c, "top", "exec_tty_stdin")
175
+	out = cli.DockerCmd(c, "top", "exec_tty_stdin").Combined()
176 176
 	outArr := strings.Split(out, "\n")
177 177
 	assert.Assert(c, len(outArr) <= 3, "exec process left running")
178 178
 	assert.Assert(c, !strings.Contains(out, "nsenter-exec"))
179 179
 }
180 180
 
181 181
 func (s *DockerCLIExecSuite) TestExecTTYWithoutStdin(c *testing.T) {
182
-	out, _ := dockerCmd(c, "run", "-d", "-ti", "busybox")
182
+	out := cli.DockerCmd(c, "run", "-d", "-ti", "busybox").Stdout()
183 183
 	id := strings.TrimSpace(out)
184
-	assert.NilError(c, waitRun(id))
184
+	cli.WaitRun(c, id)
185 185
 
186 186
 	errChan := make(chan error, 1)
187 187
 	go func() {
... ...
@@ -219,7 +217,7 @@ func (s *DockerCLIExecSuite) TestExecParseError(c *testing.T) {
219 219
 	// TODO Windows CI: Requires some extra work. Consider copying the
220 220
 	// runSleepingContainer helper to have an exec version.
221 221
 	testRequires(c, DaemonIsLinux)
222
-	dockerCmd(c, "run", "-d", "--name", "top", "busybox", "top")
222
+	cli.DockerCmd(c, "run", "-d", "--name", "top", "busybox", "top")
223 223
 
224 224
 	// Test normal (non-detached) case first
225 225
 	icmd.RunCommand(dockerBinary, "exec", "top").Assert(c, icmd.Expected{
... ...
@@ -233,7 +231,7 @@ func (s *DockerCLIExecSuite) TestExecStopNotHanging(c *testing.T) {
233 233
 	// TODO Windows CI: Requires some extra work. Consider copying the
234 234
 	// runSleepingContainer helper to have an exec version.
235 235
 	testRequires(c, DaemonIsLinux)
236
-	dockerCmd(c, "run", "-d", "--name", "testing", "busybox", "top")
236
+	cli.DockerCmd(c, "run", "-d", "--name", "testing", "busybox", "top")
237 237
 
238 238
 	result := icmd.StartCmd(icmd.Command(dockerBinary, "exec", "testing", "top"))
239 239
 	result.Assert(c, icmd.Success)
... ...
@@ -261,9 +259,9 @@ func (s *DockerCLIExecSuite) TestExecCgroup(c *testing.T) {
261 261
 	// Not applicable on Windows - using Linux specific functionality
262 262
 	testRequires(c, NotUserNamespace)
263 263
 	testRequires(c, DaemonIsLinux)
264
-	dockerCmd(c, "run", "-d", "--name", "testing", "busybox", "top")
264
+	cli.DockerCmd(c, "run", "-d", "--name", "testing", "busybox", "top")
265 265
 
266
-	out, _ := dockerCmd(c, "exec", "testing", "cat", "/proc/1/cgroup")
266
+	out := cli.DockerCmd(c, "exec", "testing", "cat", "/proc/1/cgroup").Stdout()
267 267
 	containerCgroups := sort.StringSlice(strings.Split(out, "\n"))
268 268
 
269 269
 	var wg sync.WaitGroup
... ...
@@ -311,10 +309,9 @@ func (s *DockerCLIExecSuite) TestExecCgroup(c *testing.T) {
311 311
 }
312 312
 
313 313
 func (s *DockerCLIExecSuite) TestExecInspectID(c *testing.T) {
314
-	out := runSleepingContainer(c, "-d")
315
-	id := strings.TrimSuffix(out, "\n")
314
+	id := runSleepingContainer(c, "-d")
316 315
 
317
-	out = inspectField(c, id, "ExecIDs")
316
+	out := inspectField(c, id, "ExecIDs")
318 317
 	assert.Equal(c, out, "[]", "ExecIDs should be empty, got: %s", out)
319 318
 
320 319
 	// Start an exec, have it block waiting so we can do some checking
... ...
@@ -370,8 +367,8 @@ func (s *DockerCLIExecSuite) TestExecInspectID(c *testing.T) {
370 370
 
371 371
 	// Now delete the container and then an 'inspect' on the exec should
372 372
 	// result in a 404 (not 'container not running')
373
-	out, ec := dockerCmd(c, "rm", "-f", id)
374
-	assert.Equal(c, ec, 0, "error removing container: %s", out)
373
+	res := cli.DockerCmd(c, "rm", "-f", id)
374
+	assert.Equal(c, res.ExitCode, 0, "error removing container: %s", res.Combined())
375 375
 
376 376
 	_, err = apiClient.ContainerExecInspect(testutil.GetContext(c), execID)
377 377
 	assert.ErrorContains(c, err, "No such exec instance")
... ...
@@ -380,17 +377,16 @@ func (s *DockerCLIExecSuite) TestExecInspectID(c *testing.T) {
380 380
 func (s *DockerCLIExecSuite) TestLinksPingLinkedContainersOnRename(c *testing.T) {
381 381
 	// Problematic on Windows as Windows does not support links
382 382
 	testRequires(c, DaemonIsLinux)
383
-	var out string
384
-	out, _ = dockerCmd(c, "run", "-d", "--name", "container1", "busybox", "top")
383
+	out := cli.DockerCmd(c, "run", "-d", "--name", "container1", "busybox", "top").Stdout()
385 384
 	idA := strings.TrimSpace(out)
386 385
 	assert.Assert(c, idA != "", "%s, id should not be nil", out)
387
-	out, _ = dockerCmd(c, "run", "-d", "--link", "container1:alias1", "--name", "container2", "busybox", "top")
386
+	out = cli.DockerCmd(c, "run", "-d", "--link", "container1:alias1", "--name", "container2", "busybox", "top").Stdout()
388 387
 	idB := strings.TrimSpace(out)
389 388
 	assert.Assert(c, idB != "", "%s, id should not be nil", out)
390 389
 
391
-	dockerCmd(c, "exec", "container2", "ping", "-c", "1", "alias1", "-W", "1")
392
-	dockerCmd(c, "rename", "container1", "container_new")
393
-	dockerCmd(c, "exec", "container2", "ping", "-c", "1", "alias1", "-W", "1")
390
+	cli.DockerCmd(c, "exec", "container2", "ping", "-c", "1", "alias1", "-W", "1")
391
+	cli.DockerCmd(c, "rename", "container1", "container_new")
392
+	cli.DockerCmd(c, "exec", "container2", "ping", "-c", "1", "alias1", "-W", "1")
394 393
 }
395 394
 
396 395
 func (s *DockerCLIExecSuite) TestRunMutableNetworkFiles(c *testing.T) {
... ...
@@ -406,7 +402,7 @@ func (s *DockerCLIExecSuite) TestRunMutableNetworkFiles(c *testing.T) {
406 406
 
407 407
 		assert.Equal(c, strings.TrimSpace(string(content)), "success", "Content was not what was modified in the container", string(content))
408 408
 
409
-		out, _ := dockerCmd(c, "run", "-d", "--name", "c2", "busybox", "top")
409
+		out := cli.DockerCmd(c, "run", "-d", "--name", "c2", "busybox", "top").Stdout()
410 410
 		contID := strings.TrimSpace(out)
411 411
 		netFilePath := containerStorageFile(contID, fn)
412 412
 
... ...
@@ -429,7 +425,7 @@ func (s *DockerCLIExecSuite) TestRunMutableNetworkFiles(c *testing.T) {
429 429
 		}
430 430
 		f.Close()
431 431
 
432
-		res, _ := dockerCmd(c, "exec", contID, "cat", "/etc/"+fn)
432
+		res := cli.DockerCmd(c, "exec", contID, "cat", "/etc/"+fn).Stdout()
433 433
 		assert.Equal(c, res, "success2\n")
434 434
 	}
435 435
 }
... ...
@@ -438,12 +434,12 @@ func (s *DockerCLIExecSuite) TestExecWithUser(c *testing.T) {
438 438
 	// TODO Windows CI: This may be fixable in the future once Windows
439 439
 	// supports users
440 440
 	testRequires(c, DaemonIsLinux)
441
-	dockerCmd(c, "run", "-d", "--name", "parent", "busybox", "top")
441
+	cli.DockerCmd(c, "run", "-d", "--name", "parent", "busybox", "top")
442 442
 
443
-	out, _ := dockerCmd(c, "exec", "-u", "1", "parent", "id")
443
+	out := cli.DockerCmd(c, "exec", "-u", "1", "parent", "id").Stdout()
444 444
 	assert.Assert(c, strings.Contains(out, "uid=1(daemon) gid=1(daemon)"))
445 445
 
446
-	out, _ = dockerCmd(c, "exec", "-u", "root", "parent", "id")
446
+	out = cli.DockerCmd(c, "exec", "-u", "root", "parent", "id").Stdout()
447 447
 	assert.Assert(c, strings.Contains(out, "uid=0(root) gid=0(root)"), "exec with user by id expected daemon user got %s", out)
448 448
 }
449 449
 
... ...
@@ -451,7 +447,7 @@ func (s *DockerCLIExecSuite) TestExecWithPrivileged(c *testing.T) {
451 451
 	// Not applicable on Windows
452 452
 	testRequires(c, DaemonIsLinux, NotUserNamespace)
453 453
 	// Start main loop which attempts mknod repeatedly
454
-	dockerCmd(c, "run", "-d", "--name", "parent", "--cap-drop=ALL", "busybox", "sh", "-c", `while (true); do if [ -e /exec_priv ]; then cat /exec_priv && mknod /tmp/sda b 8 0 && echo "Success"; else echo "Privileged exec has not run yet"; fi; usleep 10000; done`)
454
+	cli.DockerCmd(c, "run", "-d", "--name", "parent", "--cap-drop=ALL", "busybox", "sh", "-c", `while (true); do if [ -e /exec_priv ]; then cat /exec_priv && mknod /tmp/sda b 8 0 && echo "Success"; else echo "Privileged exec has not run yet"; fi; usleep 10000; done`)
455 455
 
456 456
 	// Check exec mknod doesn't work
457 457
 	icmd.RunCommand(dockerBinary, "exec", "parent", "sh", "-c", "mknod /tmp/sdb b 8 16").Assert(c, icmd.Expected{
... ...
@@ -480,13 +476,13 @@ func (s *DockerCLIExecSuite) TestExecWithPrivileged(c *testing.T) {
480 480
 func (s *DockerCLIExecSuite) TestExecWithImageUser(c *testing.T) {
481 481
 	// Not applicable on Windows
482 482
 	testRequires(c, DaemonIsLinux)
483
-	name := "testbuilduser"
483
+	const name = "testbuilduser"
484 484
 	buildImageSuccessfully(c, name, build.WithDockerfile(`FROM busybox
485 485
 		RUN echo 'dockerio:x:1001:1001::/bin:/bin/false' >> /etc/passwd
486 486
 		USER dockerio`))
487
-	dockerCmd(c, "run", "-d", "--name", "dockerioexec", name, "top")
487
+	cli.DockerCmd(c, "run", "-d", "--name", "dockerioexec", name, "top")
488 488
 
489
-	out, _ := dockerCmd(c, "exec", "dockerioexec", "whoami")
489
+	out := cli.DockerCmd(c, "exec", "dockerioexec", "whoami").Stdout()
490 490
 	assert.Assert(c, strings.Contains(out, "dockerio"), "exec with user by id expected dockerio user got %s", out)
491 491
 }
492 492
 
... ...
@@ -494,15 +490,15 @@ func (s *DockerCLIExecSuite) TestExecOnReadonlyContainer(c *testing.T) {
494 494
 	// Windows does not support read-only
495 495
 	// --read-only + userns has remount issues
496 496
 	testRequires(c, DaemonIsLinux, NotUserNamespace)
497
-	dockerCmd(c, "run", "-d", "--read-only", "--name", "parent", "busybox", "top")
498
-	dockerCmd(c, "exec", "parent", "true")
497
+	cli.DockerCmd(c, "run", "-d", "--read-only", "--name", "parent", "busybox", "top")
498
+	cli.DockerCmd(c, "exec", "parent", "true")
499 499
 }
500 500
 
501 501
 func (s *DockerCLIExecSuite) TestExecUlimits(c *testing.T) {
502 502
 	testRequires(c, DaemonIsLinux)
503
-	name := "testexeculimits"
503
+	const name = "testexeculimits"
504 504
 	runSleepingContainer(c, "-d", "--ulimit", "nofile=511:511", "--name", name)
505
-	assert.NilError(c, waitRun(name))
505
+	cli.WaitRun(c, name)
506 506
 
507 507
 	out, _, err := dockerCmdWithError("exec", name, "sh", "-c", "ulimit -n")
508 508
 	assert.NilError(c, err)
... ...
@@ -511,9 +507,9 @@ func (s *DockerCLIExecSuite) TestExecUlimits(c *testing.T) {
511 511
 
512 512
 // #15750
513 513
 func (s *DockerCLIExecSuite) TestExecStartFails(c *testing.T) {
514
-	name := "exec-15750"
514
+	const name = "exec-15750"
515 515
 	runSleepingContainer(c, "-d", "--name", name)
516
-	assert.NilError(c, waitRun(name))
516
+	cli.WaitRun(c, name)
517 517
 
518 518
 	out, _, err := dockerCmdWithError("exec", name, "no-such-cmd")
519 519
 	assert.ErrorContains(c, err, "", out)
... ...
@@ -528,10 +524,10 @@ func (s *DockerCLIExecSuite) TestExecStartFails(c *testing.T) {
528 528
 // Fix regression in https://github.com/docker/docker/pull/26461#issuecomment-250287297
529 529
 func (s *DockerCLIExecSuite) TestExecWindowsPathNotWiped(c *testing.T) {
530 530
 	testRequires(c, DaemonIsWindows)
531
-	out, _ := dockerCmd(c, "run", "-d", "--name", "testing", minimalBaseImage(), "powershell", "start-sleep", "60")
532
-	assert.NilError(c, waitRun(strings.TrimSpace(out)))
531
+	out := cli.DockerCmd(c, "run", "-d", "--name", "testing", minimalBaseImage(), "powershell", "start-sleep", "60").Stdout()
532
+	cli.WaitRun(c, strings.TrimSpace(out))
533 533
 
534
-	out, _ = dockerCmd(c, "exec", "testing", "powershell", "write-host", "$env:PATH")
534
+	out = cli.DockerCmd(c, "exec", "testing", "powershell", "write-host", "$env:PATH").Stdout()
535 535
 	out = strings.ToLower(strings.Trim(out, "\r\n"))
536 536
 	assert.Assert(c, strings.Contains(out, `windowspowershell\v1.0`))
537 537
 }
... ...
@@ -540,7 +536,7 @@ func (s *DockerCLIExecSuite) TestExecEnvLinksHost(c *testing.T) {
540 540
 	testRequires(c, DaemonIsLinux)
541 541
 	runSleepingContainer(c, "-d", "--name", "foo")
542 542
 	runSleepingContainer(c, "-d", "--link", "foo:db", "--hostname", "myhost", "--name", "bar")
543
-	out, _ := dockerCmd(c, "exec", "bar", "env")
543
+	out := cli.DockerCmd(c, "exec", "bar", "env").Stdout()
544 544
 	assert.Check(c, is.Contains(out, "HOSTNAME=myhost"))
545 545
 	assert.Check(c, is.Contains(out, "DB_NAME=/bar/db"))
546 546
 }
... ...
@@ -11,13 +11,14 @@ import (
11 11
 	"time"
12 12
 
13 13
 	"github.com/creack/pty"
14
+	"github.com/docker/docker/integration-cli/cli"
14 15
 	"gotest.tools/v3/assert"
15 16
 )
16 17
 
17 18
 // regression test for #12546
18 19
 func (s *DockerCLIExecSuite) TestExecInteractiveStdinClose(c *testing.T) {
19 20
 	testRequires(c, DaemonIsLinux)
20
-	out, _ := dockerCmd(c, "run", "-itd", "busybox", "/bin/cat")
21
+	out := cli.DockerCmd(c, "run", "-itd", "busybox", "/bin/cat").Stdout()
21 22
 	contID := strings.TrimSpace(out)
22 23
 
23 24
 	cmd := exec.Command(dockerBinary, "exec", "-i", contID, "echo", "-n", "hello")
... ...
@@ -46,7 +47,7 @@ func (s *DockerCLIExecSuite) TestExecInteractiveStdinClose(c *testing.T) {
46 46
 
47 47
 func (s *DockerCLIExecSuite) TestExecTTY(c *testing.T) {
48 48
 	testRequires(c, DaemonIsLinux, testEnv.IsLocalDaemon)
49
-	dockerCmd(c, "run", "-d", "--name=test", "busybox", "sh", "-c", "echo hello > /foo && top")
49
+	cli.DockerCmd(c, "run", "-d", "--name=test", "busybox", "sh", "-c", "echo hello > /foo && top")
50 50
 
51 51
 	cmd := exec.Command(dockerBinary, "exec", "-it", "test", "sh")
52 52
 	p, err := pty.Start(cmd)
... ...
@@ -76,7 +77,7 @@ func (s *DockerCLIExecSuite) TestExecTTY(c *testing.T) {
76 76
 // Test the TERM env var is set when -t is provided on exec
77 77
 func (s *DockerCLIExecSuite) TestExecWithTERM(c *testing.T) {
78 78
 	testRequires(c, DaemonIsLinux, testEnv.IsLocalDaemon)
79
-	out, _ := dockerCmd(c, "run", "-id", "busybox", "/bin/cat")
79
+	out := cli.DockerCmd(c, "run", "-id", "busybox", "/bin/cat").Stdout()
80 80
 	contID := strings.TrimSpace(out)
81 81
 	cmd := exec.Command(dockerBinary, "exec", "-t", contID, "sh", "-c", "if [ -z $TERM ]; then exit 1; else exit 0; fi")
82 82
 	if err := cmd.Run(); err != nil {
... ...
@@ -88,7 +89,7 @@ func (s *DockerCLIExecSuite) TestExecWithTERM(c *testing.T) {
88 88
 // on run
89 89
 func (s *DockerCLIExecSuite) TestExecWithNoTERM(c *testing.T) {
90 90
 	testRequires(c, DaemonIsLinux, testEnv.IsLocalDaemon)
91
-	out, _ := dockerCmd(c, "run", "-itd", "busybox", "/bin/cat")
91
+	out := cli.DockerCmd(c, "run", "-itd", "busybox", "/bin/cat").Stdout()
92 92
 	contID := strings.TrimSpace(out)
93 93
 	cmd := exec.Command(dockerBinary, "exec", contID, "sh", "-c", "if [ -z $TERM ]; then exit 0; else exit 1; fi")
94 94
 	if err := cmd.Run(); err != nil {