mirror of
https://github.com/moby/moby.git
synced 2026-08-04 23:21:00 +00:00
integration-cli: get container id from stdout only
TestDaemonRestartWithNames in the DockerDaemonSuite has been broken
since commit 72ec7cd6cc. The test takes
the combined output of a `docker run` command as the ID of the created
container. This works fine so long as the command emits no warnings,
otherwise it will corrupt the ID that the test captures. Modify the test
to read the ID from the command's stdout to make the test robust to
warnings being printed.
Signed-off-by: Cory Snider <csnider@mirantis.com>
This commit is contained in:
@@ -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 {
|
||||
|
||||
Reference in New Issue
Block a user