1
0
mirror of https://github.com/moby/moby.git synced 2025-07-30 18:23:29 +03:00

Fix some event filtering

Make it possible to use health_status, exec_start and exec_create as
is in event filter. This way, using `health_status` as filter will allow
to get all health_status events (healthy, unhealthy, …) instead of
having to us all combination (`health_status: healthy`, `health_status:
unhealthy`, …). Same goes for `exec_start` and `exec_create`.

Signed-off-by: Vincent Demeester <vincent@sbr.pm>
This commit is contained in:
Vincent Demeester
2016-10-27 16:14:13 -07:00
parent 96efb2cf25
commit 71d8313ad4
2 changed files with 50 additions and 1 deletions

View File

@ -641,6 +641,37 @@ func (s *DockerSuite) TestEventsFilterType(c *check.C) {
c.Assert(len(events), checker.GreaterOrEqualThan, 1, check.Commentf("Events == %s", events))
}
// #25798
func (s *DockerSuite) TestEventsSpecialFiltersWithExecCreate(c *check.C) {
since := daemonUnixTime(c)
runSleepingContainer(c, "--name", "test-container", "-d")
waitRun("test-container")
dockerCmd(c, "exec", "test-container", "echo", "hello-world")
out, _ := dockerCmd(
c,
"events",
"--since", since,
"--until", daemonUnixTime(c),
"--filter",
"event='exec_create: echo hello-world'",
)
events := strings.Split(strings.TrimSpace(out), "\n")
c.Assert(len(events), checker.Equals, 1, check.Commentf(out))
out, _ = dockerCmd(
c,
"events",
"--since", since,
"--until", daemonUnixTime(c),
"--filter",
"event=exec_create",
)
c.Assert(len(events), checker.Equals, 1, check.Commentf(out))
}
func (s *DockerSuite) TestEventsFilterImageInContainerAction(c *check.C) {
since := daemonUnixTime(c)
dockerCmd(c, "run", "--name", "test-container", "-d", "busybox", "true")