mirror of
https://github.com/moby/moby.git
synced 2025-07-30 18:23:29 +03: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:
committed by
Vincent Demeester
parent
10e171cd94
commit
db35c2a5a8
@ -15,6 +15,7 @@ import (
|
||||
eventtypes "github.com/docker/docker/api/types/events"
|
||||
eventstestutils "github.com/docker/docker/daemon/events/testutils"
|
||||
"github.com/docker/docker/integration-cli/checker"
|
||||
"github.com/docker/docker/integration-cli/cli"
|
||||
"github.com/docker/docker/integration-cli/cli/build"
|
||||
"github.com/docker/docker/integration-cli/request"
|
||||
"github.com/docker/docker/pkg/testutil"
|
||||
@ -453,14 +454,14 @@ func (s *DockerSuite) TestEventsCommit(c *check.C) {
|
||||
|
||||
out, _ := runSleepingContainer(c)
|
||||
cID := strings.TrimSpace(out)
|
||||
c.Assert(waitRun(cID), checker.IsNil)
|
||||
cli.WaitRun(c, cID)
|
||||
|
||||
dockerCmd(c, "commit", "-m", "test", cID)
|
||||
dockerCmd(c, "stop", cID)
|
||||
c.Assert(waitExited(cID, 5*time.Second), checker.IsNil)
|
||||
cli.DockerCmd(c, "commit", "-m", "test", cID)
|
||||
cli.DockerCmd(c, "stop", cID)
|
||||
cli.WaitExited(c, cID, 5*time.Second)
|
||||
|
||||
until := daemonUnixTime(c)
|
||||
out, _ = dockerCmd(c, "events", "-f", "container="+cID, "--until="+until)
|
||||
out = cli.DockerCmd(c, "events", "-f", "container="+cID, "--until="+until).Combined()
|
||||
c.Assert(out, checker.Contains, "commit", check.Commentf("Missing 'commit' log event"))
|
||||
}
|
||||
|
||||
@ -514,9 +515,9 @@ func (s *DockerSuite) TestEventsAttach(c *check.C) {
|
||||
// TODO Windows CI: Figure out why this test fails intermittently (TP5).
|
||||
testRequires(c, DaemonIsLinux)
|
||||
|
||||
out, _ := dockerCmd(c, "run", "-di", "busybox", "cat")
|
||||
out := cli.DockerCmd(c, "run", "-di", "busybox", "cat").Combined()
|
||||
cID := strings.TrimSpace(out)
|
||||
c.Assert(waitRun(cID), checker.IsNil)
|
||||
cli.WaitRun(c, cID)
|
||||
|
||||
cmd := exec.Command(dockerBinary, "attach", cID)
|
||||
stdin, err := cmd.StdinPipe()
|
||||
@ -537,11 +538,11 @@ func (s *DockerSuite) TestEventsAttach(c *check.C) {
|
||||
|
||||
c.Assert(stdin.Close(), checker.IsNil)
|
||||
|
||||
dockerCmd(c, "kill", cID)
|
||||
c.Assert(waitExited(cID, 5*time.Second), checker.IsNil)
|
||||
cli.DockerCmd(c, "kill", cID)
|
||||
cli.WaitExited(c, cID, 5*time.Second)
|
||||
|
||||
until := daemonUnixTime(c)
|
||||
out, _ = dockerCmd(c, "events", "-f", "container="+cID, "--until="+until)
|
||||
out = cli.DockerCmd(c, "events", "-f", "container="+cID, "--until="+until).Combined()
|
||||
c.Assert(out, checker.Contains, "attach", check.Commentf("Missing 'attach' log event"))
|
||||
}
|
||||
|
||||
|
Reference in New Issue
Block a user