1
0
Fork 0
mirror of https://github.com/moby/moby.git synced 2022-11-09 12:21:53 -05:00

Introduce cli.Wait* fuctions

These replace `wait*` functions from `docker_utils_test.go` and work
more or less like other `cli` functions.

Signed-off-by: Vincent Demeester <vincent@sbr.pm>
This commit is contained in:
Vincent Demeester 2017-04-11 21:18:30 +02:00 committed by Vincent Demeester
parent 10e171cd94
commit db35c2a5a8
17 changed files with 195 additions and 156 deletions

View file

@ -8,6 +8,7 @@ import (
"time"
"github.com/docker/docker/integration-cli/checker"
"github.com/docker/docker/integration-cli/cli"
"github.com/go-check/check"
)
@ -162,17 +163,17 @@ func (s *DockerSuite) TestStatsFormatAll(c *check.C) {
// Windows does not support stats
testRequires(c, DaemonIsLinux)
dockerCmd(c, "run", "-d", "--name=RunningOne", "busybox", "top")
c.Assert(waitRun("RunningOne"), check.IsNil)
dockerCmd(c, "run", "-d", "--name=ExitedOne", "busybox", "top")
dockerCmd(c, "stop", "ExitedOne")
c.Assert(waitExited("ExitedOne", 5*time.Second), check.IsNil)
cli.DockerCmd(c, "run", "-d", "--name=RunningOne", "busybox", "top")
cli.WaitRun(c, "RunningOne")
cli.DockerCmd(c, "run", "-d", "--name=ExitedOne", "busybox", "top")
cli.DockerCmd(c, "stop", "ExitedOne")
cli.WaitExited(c, "ExitedOne", 5*time.Second)
out, _ := dockerCmd(c, "stats", "--no-stream", "--format", "{{.Name}}")
out := cli.DockerCmd(c, "stats", "--no-stream", "--format", "{{.Name}}").Combined()
c.Assert(out, checker.Contains, "RunningOne")
c.Assert(out, checker.Not(checker.Contains), "ExitedOne")
out, _ = dockerCmd(c, "stats", "--all", "--no-stream", "--format", "{{.Name}}")
out = cli.DockerCmd(c, "stats", "--all", "--no-stream", "--format", "{{.Name}}").Combined()
c.Assert(out, checker.Contains, "RunningOne")
c.Assert(out, checker.Contains, "ExitedOne")
}