diff --git a/integration-cli/daemon/daemon.go b/integration-cli/daemon/daemon.go index 4919c7ebb0..1094fc21e4 100644 --- a/integration-cli/daemon/daemon.go +++ b/integration-cli/daemon/daemon.go @@ -37,10 +37,16 @@ func New(t testing.TB, dockerBinary string, dockerdBinary string, ops ...daemon. // Cmd executes a docker CLI command against this daemon. // Example: d.Cmd("version") will run docker -H unix://path/to/unix.sock version func (d *Daemon) Cmd(args ...string) (string, error) { - result := icmd.RunCmd(d.Command(args...)) + result := d.RunCmd(args...) return result.Combined(), result.Error } +// RunCmd executes a docker CLI command against this daemon and returns the result. +// Example: d.RunCmd("version") will run docker -H unix://path/to/unix.sock version +func (d *Daemon) RunCmd(args ...string) *icmd.Result { + return icmd.RunCmd(d.Command(args...)) +} + // Command creates a docker CLI command against this daemon, to be executed later. // Example: d.Command("version") creates a command to run "docker -H unix://path/to/unix.sock version" func (d *Daemon) Command(args ...string) icmd.Cmd { diff --git a/integration-cli/docker_cli_daemon_test.go b/integration-cli/docker_cli_daemon_test.go index e8dd08260f..6098dfb24a 100644 --- a/integration-cli/docker_cli_daemon_test.go +++ b/integration-cli/docker_cli_daemon_test.go @@ -1238,9 +1238,10 @@ func (s *DockerDaemonSuite) TestDaemonRestartWithNames(c *testing.T) { assert.NilError(c, err, out) test2ID := strings.TrimSpace(out) - out, err = s.d.Cmd("run", "-d", "--name=test3", "--link", "test2:abc", "busybox", "top") - assert.NilError(c, err) - test3ID := strings.TrimSpace(out) + res := s.d.RunCmd("run", "-d", "--name=test3", "--link", "test2:abc", "busybox", "top") + assert.NilError(c, res.Error) + // Discard any warnings about legacy links, which are emitted on stderr. + test3ID := strings.TrimSpace(res.Stdout()) s.d.Restart(c)