TestCase: use icmd.RunCmd instead icmd.StartCmd

Use `cli.Docker` instead `dockerCmdWithResult`.

Signed-off-by: Jintao Zhang <zhangjintao9020@gmail.com>
This commit is contained in:
Jintao Zhang 2019-09-03 07:12:58 +08:00
parent 1a117b8b5c
commit e6fce00ec8

View file

@ -1792,16 +1792,14 @@ func (s *DockerSuite) TestRunExitOnStdinClose(c *check.C) {
func (s *DockerSuite) TestRunInteractiveWithRestartPolicy(c *check.C) { func (s *DockerSuite) TestRunInteractiveWithRestartPolicy(c *check.C) {
name := "test-inter-restart" name := "test-inter-restart"
result := icmd.StartCmd(icmd.Cmd{ result := icmd.RunCmd(icmd.Cmd{
Command: []string{dockerBinary, "run", "-i", "--name", name, "--restart=always", "busybox", "sh"}, Command: []string{dockerBinary, "run", "-i", "--name", name, "--restart=always", "busybox", "sh"},
Stdin: bytes.NewBufferString("exit 11"), Stdin: bytes.NewBufferString("exit 11"),
}) })
assert.NilError(c, result.Error)
defer func() { defer func() {
dockerCmdWithResult("stop", name).Assert(c, icmd.Success) cli.Docker(cli.Args("stop", name)).Assert(c, icmd.Success)
}() }()
result = icmd.WaitOnCmd(60*time.Second, result)
result.Assert(c, icmd.Expected{ExitCode: 11}) result.Assert(c, icmd.Expected{ExitCode: 11})
} }