2014-06-05 06:32:19 -04:00
|
|
|
package main
|
|
|
|
|
|
|
|
import (
|
2015-04-05 09:01:52 -04:00
|
|
|
"bufio"
|
2014-07-07 11:47:06 -04:00
|
|
|
"fmt"
|
2015-05-14 16:44:29 -04:00
|
|
|
"io/ioutil"
|
2015-05-24 14:19:39 -04:00
|
|
|
"net/http"
|
2015-05-14 16:44:29 -04:00
|
|
|
"os"
|
2014-06-05 06:32:19 -04:00
|
|
|
"os/exec"
|
2014-07-04 01:12:21 -04:00
|
|
|
"strconv"
|
2014-06-05 06:32:19 -04:00
|
|
|
"strings"
|
2015-04-27 15:12:23 -04:00
|
|
|
"sync"
|
2014-07-07 11:47:06 -04:00
|
|
|
"time"
|
2015-04-18 12:46:47 -04:00
|
|
|
|
2015-09-23 14:51:43 -04:00
|
|
|
"github.com/docker/docker/pkg/integration/checker"
|
2015-04-18 12:46:47 -04:00
|
|
|
"github.com/go-check/check"
|
2014-06-05 06:32:19 -04:00
|
|
|
)
|
|
|
|
|
2015-05-13 12:27:00 -04:00
|
|
|
func (s *DockerSuite) TestEventsTimestampFormats(c *check.C) {
|
|
|
|
image := "busybox"
|
|
|
|
|
|
|
|
// Start stopwatch, generate an event
|
2015-08-11 03:41:11 -04:00
|
|
|
time.Sleep(1 * time.Second) // so that we don't grab events from previous test occured in the same second
|
2015-05-13 12:27:00 -04:00
|
|
|
start := daemonTime(c)
|
|
|
|
dockerCmd(c, "tag", image, "timestamptest:1")
|
|
|
|
dockerCmd(c, "rmi", "timestamptest:1")
|
2015-08-11 03:41:11 -04:00
|
|
|
time.Sleep(1 * time.Second) // so that until > since
|
2015-05-13 12:27:00 -04:00
|
|
|
end := daemonTime(c)
|
|
|
|
|
|
|
|
// List of available time formats to --since
|
|
|
|
unixTs := func(t time.Time) string { return fmt.Sprintf("%v", t.Unix()) }
|
|
|
|
rfc3339 := func(t time.Time) string { return t.Format(time.RFC3339) }
|
2015-05-12 15:59:34 -04:00
|
|
|
duration := func(t time.Time) string { return time.Now().Sub(t).String() }
|
2015-05-13 12:27:00 -04:00
|
|
|
|
|
|
|
// --since=$start must contain only the 'untag' event
|
2015-05-12 15:59:34 -04:00
|
|
|
for _, f := range []func(time.Time) string{unixTs, rfc3339, duration} {
|
2015-05-13 12:27:00 -04:00
|
|
|
since, until := f(start), f(end)
|
2015-07-20 02:55:40 -04:00
|
|
|
out, _ := dockerCmd(c, "events", "--since="+since, "--until="+until)
|
2015-05-13 12:27:00 -04:00
|
|
|
events := strings.Split(strings.TrimSpace(out), "\n")
|
2015-10-19 22:56:29 -04:00
|
|
|
c.Assert(events, checker.HasLen, 2, check.Commentf("unexpected events, was expecting only 2 events tag/untag (since=%s, until=%s) out=%s", since, until, out))
|
|
|
|
c.Assert(out, checker.Contains, "untag", check.Commentf("expected 'untag' event not found (since=%s, until=%s)", since, until))
|
2015-05-13 12:27:00 -04:00
|
|
|
}
|
|
|
|
|
|
|
|
}
|
|
|
|
|
2015-04-18 12:46:47 -04:00
|
|
|
func (s *DockerSuite) TestEventsUntag(c *check.C) {
|
2014-10-23 17:30:11 -04:00
|
|
|
image := "busybox"
|
2015-04-18 12:46:47 -04:00
|
|
|
dockerCmd(c, "tag", image, "utest:tag1")
|
|
|
|
dockerCmd(c, "tag", image, "utest:tag2")
|
|
|
|
dockerCmd(c, "rmi", "utest:tag1")
|
|
|
|
dockerCmd(c, "rmi", "utest:tag2")
|
2015-02-14 04:19:57 -05:00
|
|
|
eventsCmd := exec.Command(dockerBinary, "events", "--since=1")
|
2015-11-20 17:12:12 -05:00
|
|
|
out, exitCode, _, err := runCommandWithOutputForDuration(eventsCmd, time.Duration(time.Millisecond*2500))
|
2015-10-19 22:56:29 -04:00
|
|
|
c.Assert(err, checker.IsNil)
|
|
|
|
c.Assert(exitCode, checker.Equals, 0, check.Commentf("Failed to get events"))
|
2014-06-05 06:32:19 -04:00
|
|
|
events := strings.Split(out, "\n")
|
2014-10-06 10:26:55 -04:00
|
|
|
nEvents := len(events)
|
2014-06-05 06:32:19 -04:00
|
|
|
// The last element after the split above will be an empty string, so we
|
|
|
|
// get the two elements before the last, which are the untags we're
|
|
|
|
// looking for.
|
2014-10-06 10:26:55 -04:00
|
|
|
for _, v := range events[nEvents-3 : nEvents-1] {
|
2015-10-19 22:56:29 -04:00
|
|
|
c.Assert(v, checker.Contains, "untag", check.Commentf("event should be untag"))
|
2014-06-05 06:32:19 -04:00
|
|
|
}
|
|
|
|
}
|
2014-07-07 11:47:06 -04:00
|
|
|
|
2015-04-18 12:46:47 -04:00
|
|
|
func (s *DockerSuite) TestEventsContainerFailStartDie(c *check.C) {
|
2016-01-26 06:23:18 -05:00
|
|
|
_, _, err := dockerCmdWithError("run", "--name", "testeventdie", "busybox", "blerg")
|
|
|
|
c.Assert(err, checker.NotNil, check.Commentf("Container run with command blerg should have failed, but it did not"))
|
2014-09-19 16:54:32 -04:00
|
|
|
|
2016-01-26 06:23:18 -05:00
|
|
|
out, _ := dockerCmd(c, "events", "--since=0", fmt.Sprintf("--until=%d", daemonTime(c).Unix()))
|
2015-12-28 15:15:34 -05:00
|
|
|
events := strings.Split(strings.TrimSpace(out), "\n")
|
2014-09-19 16:54:32 -04:00
|
|
|
|
2015-12-21 17:55:23 -05:00
|
|
|
nEvents := len(events)
|
|
|
|
c.Assert(nEvents, checker.GreaterOrEqualThan, 1) //Missing expected event
|
2014-09-19 16:54:32 -04:00
|
|
|
|
2015-12-28 15:15:34 -05:00
|
|
|
actions := eventActionsByIDAndType(c, events, "testeventdie", "container")
|
|
|
|
|
|
|
|
var startEvent bool
|
|
|
|
var dieEvent bool
|
|
|
|
for _, a := range actions {
|
|
|
|
switch a {
|
|
|
|
case "start":
|
|
|
|
startEvent = true
|
|
|
|
case "die":
|
|
|
|
dieEvent = true
|
|
|
|
}
|
|
|
|
}
|
|
|
|
c.Assert(startEvent, checker.True, check.Commentf("Start event not found: %v\n%v", actions, events))
|
|
|
|
c.Assert(dieEvent, checker.True, check.Commentf("Die event not found: %v\n%v", actions, events))
|
2014-09-19 16:54:32 -04:00
|
|
|
}
|
|
|
|
|
2015-04-18 12:46:47 -04:00
|
|
|
func (s *DockerSuite) TestEventsLimit(c *check.C) {
|
2016-01-26 18:14:58 -05:00
|
|
|
// TODO Windows CI: This test is not reliable enough on Windows TP4. Reports
|
|
|
|
// multiple errors in the analytic log sometimes.
|
|
|
|
// [NetSetupHelper::InstallVirtualMiniport()@2153] NetSetup install of ROOT\VMS_MP\0001 failed with error 0x80070002
|
|
|
|
// This should be able to be enabled on TP5.
|
2015-08-28 13:36:42 -04:00
|
|
|
testRequires(c, DaemonIsLinux)
|
2015-04-27 15:12:23 -04:00
|
|
|
var waitGroup sync.WaitGroup
|
|
|
|
errChan := make(chan error, 17)
|
|
|
|
|
|
|
|
args := []string{"run", "--rm", "busybox", "true"}
|
|
|
|
for i := 0; i < 17; i++ {
|
|
|
|
waitGroup.Add(1)
|
|
|
|
go func() {
|
|
|
|
defer waitGroup.Done()
|
2015-04-27 13:29:48 -04:00
|
|
|
errChan <- exec.Command(dockerBinary, args...).Run()
|
2015-04-27 15:12:23 -04:00
|
|
|
}()
|
2014-07-04 01:12:21 -04:00
|
|
|
}
|
2015-04-27 15:12:23 -04:00
|
|
|
|
|
|
|
waitGroup.Wait()
|
|
|
|
close(errChan)
|
|
|
|
|
|
|
|
for err := range errChan {
|
2015-10-19 22:56:29 -04:00
|
|
|
c.Assert(err, checker.IsNil, check.Commentf("%q failed with error", strings.Join(args, " ")))
|
2015-04-27 15:12:23 -04:00
|
|
|
}
|
|
|
|
|
2015-07-20 02:55:40 -04:00
|
|
|
out, _ := dockerCmd(c, "events", "--since=0", fmt.Sprintf("--until=%d", daemonTime(c).Unix()))
|
2014-07-04 01:12:21 -04:00
|
|
|
events := strings.Split(out, "\n")
|
2014-10-06 10:26:55 -04:00
|
|
|
nEvents := len(events) - 1
|
2015-10-19 22:56:29 -04:00
|
|
|
c.Assert(nEvents, checker.Equals, 64, check.Commentf("events should be limited to 64, but received %d", nEvents))
|
2014-07-04 01:12:21 -04:00
|
|
|
}
|
2014-08-11 01:54:59 -04:00
|
|
|
|
2015-04-18 12:46:47 -04:00
|
|
|
func (s *DockerSuite) TestEventsContainerEvents(c *check.C) {
|
2015-12-21 17:55:23 -05:00
|
|
|
containerID, _ := dockerCmd(c, "run", "--rm", "--name", "container-events-test", "busybox", "true")
|
|
|
|
containerID = strings.TrimSpace(containerID)
|
|
|
|
|
2015-07-20 02:55:40 -04:00
|
|
|
out, _ := dockerCmd(c, "events", "--since=0", fmt.Sprintf("--until=%d", daemonTime(c).Unix()))
|
2014-08-11 01:54:59 -04:00
|
|
|
events := strings.Split(out, "\n")
|
|
|
|
events = events[:len(events)-1]
|
|
|
|
|
2015-12-21 17:55:23 -05:00
|
|
|
nEvents := len(events)
|
|
|
|
c.Assert(nEvents, checker.GreaterOrEqualThan, 5) //Missing expected event
|
|
|
|
containerEvents := eventActionsByIDAndType(c, events, "container-events-test", "container")
|
|
|
|
c.Assert(containerEvents, checker.HasLen, 5, check.Commentf("events: %v", events))
|
|
|
|
|
|
|
|
c.Assert(containerEvents[0], checker.Equals, "create", check.Commentf(out))
|
|
|
|
c.Assert(containerEvents[1], checker.Equals, "attach", check.Commentf(out))
|
|
|
|
c.Assert(containerEvents[2], checker.Equals, "start", check.Commentf(out))
|
|
|
|
c.Assert(containerEvents[3], checker.Equals, "die", check.Commentf(out))
|
|
|
|
c.Assert(containerEvents[4], checker.Equals, "destroy", check.Commentf(out))
|
2014-08-11 01:54:59 -04:00
|
|
|
}
|
2014-08-11 03:39:47 -04:00
|
|
|
|
2016-01-26 21:48:14 -05:00
|
|
|
func (s *DockerSuite) TestEventsContainerEventsAttrSort(c *check.C) {
|
|
|
|
since := daemonTime(c).Unix()
|
|
|
|
containerID, _ := dockerCmd(c, "run", "-d", "--name", "container-events-test", "busybox", "true")
|
|
|
|
containerID = strings.TrimSpace(containerID)
|
|
|
|
|
|
|
|
out, _ := dockerCmd(c, "events", fmt.Sprintf("--since=%d", since), fmt.Sprintf("--until=%d", daemonTime(c).Unix()))
|
|
|
|
events := strings.Split(out, "\n")
|
|
|
|
|
|
|
|
nEvents := len(events)
|
|
|
|
c.Assert(nEvents, checker.GreaterOrEqualThan, 3) //Missing expected event
|
|
|
|
matchedEvents := 0
|
|
|
|
for _, event := range events {
|
|
|
|
matches := parseEventText(event)
|
|
|
|
if matches["id"] != containerID {
|
|
|
|
continue
|
|
|
|
}
|
|
|
|
if matches["eventType"] == "container" && matches["action"] == "create" {
|
|
|
|
matchedEvents++
|
|
|
|
c.Assert(out, checker.Contains, "(image=busybox, name=container-events-test)", check.Commentf("Event attributes not sorted"))
|
|
|
|
} else if matches["eventType"] == "container" && matches["action"] == "start" {
|
|
|
|
matchedEvents++
|
|
|
|
c.Assert(out, checker.Contains, "(image=busybox, name=container-events-test)", check.Commentf("Event attributes not sorted"))
|
|
|
|
}
|
|
|
|
}
|
|
|
|
c.Assert(matchedEvents, checker.Equals, 2)
|
|
|
|
}
|
|
|
|
|
2015-04-18 12:46:47 -04:00
|
|
|
func (s *DockerSuite) TestEventsContainerEventsSinceUnixEpoch(c *check.C) {
|
2015-12-21 17:55:23 -05:00
|
|
|
dockerCmd(c, "run", "--rm", "--name", "since-epoch-test", "busybox", "true")
|
2015-03-22 15:40:16 -04:00
|
|
|
timeBeginning := time.Unix(0, 0).Format(time.RFC3339Nano)
|
|
|
|
timeBeginning = strings.Replace(timeBeginning, "Z", ".000000000Z", -1)
|
2015-12-21 17:55:23 -05:00
|
|
|
out, _ := dockerCmd(c, "events", fmt.Sprintf("--since='%s'", timeBeginning), fmt.Sprintf("--until=%d", daemonTime(c).Unix()))
|
2015-03-22 15:40:16 -04:00
|
|
|
events := strings.Split(out, "\n")
|
|
|
|
events = events[:len(events)-1]
|
|
|
|
|
2015-12-21 17:55:23 -05:00
|
|
|
nEvents := len(events)
|
|
|
|
c.Assert(nEvents, checker.GreaterOrEqualThan, 5) //Missing expected event
|
|
|
|
containerEvents := eventActionsByIDAndType(c, events, "since-epoch-test", "container")
|
|
|
|
c.Assert(containerEvents, checker.HasLen, 5, check.Commentf("events: %v", events))
|
|
|
|
|
|
|
|
c.Assert(containerEvents[0], checker.Equals, "create", check.Commentf(out))
|
|
|
|
c.Assert(containerEvents[1], checker.Equals, "attach", check.Commentf(out))
|
|
|
|
c.Assert(containerEvents[2], checker.Equals, "start", check.Commentf(out))
|
|
|
|
c.Assert(containerEvents[3], checker.Equals, "die", check.Commentf(out))
|
|
|
|
c.Assert(containerEvents[4], checker.Equals, "destroy", check.Commentf(out))
|
2015-03-22 15:40:16 -04:00
|
|
|
}
|
|
|
|
|
2015-05-14 20:01:06 -04:00
|
|
|
func (s *DockerSuite) TestEventsImageTag(c *check.C) {
|
2015-08-11 03:41:11 -04:00
|
|
|
time.Sleep(1 * time.Second) // because API has seconds granularity
|
2015-05-14 20:01:06 -04:00
|
|
|
since := daemonTime(c).Unix()
|
|
|
|
image := "testimageevents:tag"
|
|
|
|
dockerCmd(c, "tag", "busybox", image)
|
|
|
|
|
2015-07-20 02:55:40 -04:00
|
|
|
out, _ := dockerCmd(c, "events",
|
2015-05-14 20:01:06 -04:00
|
|
|
fmt.Sprintf("--since=%d", since),
|
|
|
|
fmt.Sprintf("--until=%d", daemonTime(c).Unix()))
|
|
|
|
|
|
|
|
events := strings.Split(strings.TrimSpace(out), "\n")
|
2015-10-19 22:56:29 -04:00
|
|
|
c.Assert(events, checker.HasLen, 1, check.Commentf("was expecting 1 event. out=%s", out))
|
2015-05-14 20:01:06 -04:00
|
|
|
event := strings.TrimSpace(events[0])
|
|
|
|
|
2015-12-21 17:55:23 -05:00
|
|
|
matches := parseEventText(event)
|
|
|
|
c.Assert(matchEventID(matches, image), checker.True, check.Commentf("matches: %v\nout:\n%s", matches, out))
|
|
|
|
c.Assert(matches["action"], checker.Equals, "tag")
|
2015-05-14 20:01:06 -04:00
|
|
|
}
|
|
|
|
|
2015-04-18 12:46:47 -04:00
|
|
|
func (s *DockerSuite) TestEventsImagePull(c *check.C) {
|
2016-01-26 18:14:58 -05:00
|
|
|
// TODO Windows: Enable this test once pull and reliable image names are available
|
2015-08-28 13:36:42 -04:00
|
|
|
testRequires(c, DaemonIsLinux)
|
2015-04-18 12:46:47 -04:00
|
|
|
since := daemonTime(c).Unix()
|
|
|
|
testRequires(c, Network)
|
2015-02-05 20:46:55 -05:00
|
|
|
|
2015-07-20 02:55:40 -04:00
|
|
|
dockerCmd(c, "pull", "hello-world")
|
2014-10-22 09:48:02 -04:00
|
|
|
|
2015-07-20 02:55:40 -04:00
|
|
|
out, _ := dockerCmd(c, "events",
|
2014-10-22 09:48:02 -04:00
|
|
|
fmt.Sprintf("--since=%d", since),
|
2015-04-18 12:46:47 -04:00
|
|
|
fmt.Sprintf("--until=%d", daemonTime(c).Unix()))
|
2014-10-22 09:48:02 -04:00
|
|
|
|
|
|
|
events := strings.Split(strings.TrimSpace(out), "\n")
|
|
|
|
event := strings.TrimSpace(events[len(events)-1])
|
2015-12-21 17:55:23 -05:00
|
|
|
matches := parseEventText(event)
|
|
|
|
c.Assert(matches["id"], checker.Equals, "hello-world:latest")
|
|
|
|
c.Assert(matches["action"], checker.Equals, "pull")
|
2014-10-22 09:48:02 -04:00
|
|
|
|
|
|
|
}
|
|
|
|
|
2015-04-18 12:46:47 -04:00
|
|
|
func (s *DockerSuite) TestEventsImageImport(c *check.C) {
|
2016-01-26 18:14:58 -05:00
|
|
|
// TODO Windows CI. This should be portable once export/import are
|
|
|
|
// more reliable (@swernli)
|
2015-08-28 13:36:42 -04:00
|
|
|
testRequires(c, DaemonIsLinux)
|
2014-10-22 09:48:02 -04:00
|
|
|
|
2015-07-20 02:55:40 -04:00
|
|
|
out, _ := dockerCmd(c, "run", "-d", "busybox", "true")
|
2015-04-06 09:21:18 -04:00
|
|
|
cleanedContainerID := strings.TrimSpace(out)
|
2015-02-14 05:27:06 -05:00
|
|
|
|
2015-12-21 17:55:23 -05:00
|
|
|
since := daemonTime(c).Unix()
|
|
|
|
out, _, err := runCommandPipelineWithOutput(
|
2015-02-14 05:27:06 -05:00
|
|
|
exec.Command(dockerBinary, "export", cleanedContainerID),
|
|
|
|
exec.Command(dockerBinary, "import", "-"),
|
|
|
|
)
|
2015-10-19 22:56:29 -04:00
|
|
|
c.Assert(err, checker.IsNil, check.Commentf("import failed with output: %q", out))
|
2015-12-21 15:34:08 -05:00
|
|
|
imageRef := strings.TrimSpace(out)
|
|
|
|
|
2015-12-21 17:55:23 -05:00
|
|
|
out, _ = dockerCmd(c, "events", fmt.Sprintf("--since=%d", since), fmt.Sprintf("--until=%d", daemonTime(c).Unix()), "--filter", "event=import")
|
|
|
|
events := strings.Split(strings.TrimSpace(out), "\n")
|
|
|
|
c.Assert(events, checker.HasLen, 1)
|
|
|
|
matches := parseEventText(events[0])
|
|
|
|
c.Assert(matches["id"], checker.Equals, imageRef, check.Commentf("matches: %v\nout:\n%s\n", matches, out))
|
|
|
|
c.Assert(matches["action"], checker.Equals, "import", check.Commentf("matches: %v\nout:\n%s\n", matches, out))
|
2014-10-22 09:48:02 -04:00
|
|
|
}
|
2014-11-20 14:46:48 -05:00
|
|
|
|
2015-04-18 12:46:47 -04:00
|
|
|
func (s *DockerSuite) TestEventsFilters(c *check.C) {
|
|
|
|
since := daemonTime(c).Unix()
|
2015-07-20 02:55:40 -04:00
|
|
|
dockerCmd(c, "run", "--rm", "busybox", "true")
|
|
|
|
dockerCmd(c, "run", "--rm", "busybox", "true")
|
|
|
|
out, _ := dockerCmd(c, "events", fmt.Sprintf("--since=%d", since), fmt.Sprintf("--until=%d", daemonTime(c).Unix()), "--filter", "event=die")
|
2015-12-21 17:55:23 -05:00
|
|
|
parseEvents(c, out, "die")
|
2014-11-20 14:46:48 -05:00
|
|
|
|
2015-07-20 02:55:40 -04:00
|
|
|
out, _ = dockerCmd(c, "events", fmt.Sprintf("--since=%d", since), fmt.Sprintf("--until=%d", daemonTime(c).Unix()), "--filter", "event=die", "--filter", "event=start")
|
2015-12-21 17:55:23 -05:00
|
|
|
parseEvents(c, out, "die|start")
|
2015-02-24 19:24:19 -05:00
|
|
|
|
|
|
|
// make sure we at least got 2 start events
|
|
|
|
count := strings.Count(out, "start")
|
2015-10-19 22:56:29 -04:00
|
|
|
c.Assert(strings.Count(out, "start"), checker.GreaterOrEqualThan, 2, check.Commentf("should have had 2 start events but had %d, out: %s", count, out))
|
2014-11-20 14:46:48 -05:00
|
|
|
|
|
|
|
}
|
2015-02-09 16:02:53 -05:00
|
|
|
|
2015-04-18 12:46:47 -04:00
|
|
|
func (s *DockerSuite) TestEventsFilterImageName(c *check.C) {
|
|
|
|
since := daemonTime(c).Unix()
|
2015-02-09 16:02:53 -05:00
|
|
|
|
2015-07-20 02:55:40 -04:00
|
|
|
out, _ := dockerCmd(c, "run", "--name", "container_1", "-d", "busybox:latest", "true")
|
2015-04-06 09:21:18 -04:00
|
|
|
container1 := strings.TrimSpace(out)
|
2015-02-09 01:03:42 -05:00
|
|
|
|
2015-07-20 02:55:40 -04:00
|
|
|
out, _ = dockerCmd(c, "run", "--name", "container_2", "-d", "busybox", "true")
|
2015-04-06 09:21:18 -04:00
|
|
|
container2 := strings.TrimSpace(out)
|
2015-02-09 16:02:53 -05:00
|
|
|
|
2015-04-18 12:46:47 -04:00
|
|
|
name := "busybox"
|
2015-07-20 02:55:40 -04:00
|
|
|
out, _ = dockerCmd(c, "events", fmt.Sprintf("--since=%d", since), fmt.Sprintf("--until=%d", daemonTime(c).Unix()), "--filter", fmt.Sprintf("image=%s", name))
|
2015-04-01 10:08:00 -04:00
|
|
|
events := strings.Split(out, "\n")
|
|
|
|
events = events[:len(events)-1]
|
2015-10-19 22:56:29 -04:00
|
|
|
c.Assert(events, checker.Not(checker.HasLen), 0) //Expected events but found none for the image busybox:latest
|
2015-04-01 10:08:00 -04:00
|
|
|
count1 := 0
|
|
|
|
count2 := 0
|
|
|
|
|
|
|
|
for _, e := range events {
|
|
|
|
if strings.Contains(e, container1) {
|
|
|
|
count1++
|
|
|
|
} else if strings.Contains(e, container2) {
|
|
|
|
count2++
|
2015-02-09 16:02:53 -05:00
|
|
|
}
|
|
|
|
}
|
2015-10-19 22:56:29 -04:00
|
|
|
c.Assert(count1, checker.Not(checker.Equals), 0, check.Commentf("Expected event from container but got %d from %s", count1, container1))
|
|
|
|
c.Assert(count2, checker.Not(checker.Equals), 0, check.Commentf("Expected event from container but got %d from %s", count2, container2))
|
2015-02-09 16:02:53 -05:00
|
|
|
|
2015-02-09 01:03:42 -05:00
|
|
|
}
|
|
|
|
|
2015-09-23 14:51:43 -04:00
|
|
|
func (s *DockerSuite) TestEventsFilterLabels(c *check.C) {
|
|
|
|
since := daemonTime(c).Unix()
|
|
|
|
label := "io.docker.testing=foo"
|
|
|
|
|
|
|
|
out, _ := dockerCmd(c, "run", "-d", "-l", label, "busybox:latest", "true")
|
|
|
|
container1 := strings.TrimSpace(out)
|
|
|
|
|
|
|
|
out, _ = dockerCmd(c, "run", "-d", "busybox", "true")
|
|
|
|
container2 := strings.TrimSpace(out)
|
|
|
|
|
|
|
|
out, _ = dockerCmd(
|
|
|
|
c,
|
|
|
|
"events",
|
|
|
|
fmt.Sprintf("--since=%d", since),
|
|
|
|
fmt.Sprintf("--until=%d", daemonTime(c).Unix()),
|
|
|
|
"--filter", fmt.Sprintf("label=%s", label))
|
|
|
|
|
|
|
|
events := strings.Split(strings.TrimSpace(out), "\n")
|
|
|
|
c.Assert(len(events), checker.Equals, 3)
|
|
|
|
|
|
|
|
for _, e := range events {
|
|
|
|
c.Assert(e, checker.Contains, container1)
|
2015-10-19 22:56:29 -04:00
|
|
|
c.Assert(e, checker.Not(checker.Contains), container2)
|
2015-09-23 14:51:43 -04:00
|
|
|
}
|
|
|
|
}
|
|
|
|
|
|
|
|
func (s *DockerSuite) TestEventsFilterImageLabels(c *check.C) {
|
|
|
|
since := daemonTime(c).Unix()
|
2015-10-16 11:54:05 -04:00
|
|
|
name := "labelfiltertest"
|
2015-09-23 14:51:43 -04:00
|
|
|
label := "io.docker.testing=image"
|
|
|
|
|
|
|
|
// Build a test image.
|
2015-10-16 11:54:05 -04:00
|
|
|
_, err := buildImage(name, fmt.Sprintf(`
|
2015-09-23 14:51:43 -04:00
|
|
|
FROM busybox:latest
|
2015-10-16 11:54:05 -04:00
|
|
|
LABEL %s`, label), true)
|
2015-10-19 22:56:29 -04:00
|
|
|
c.Assert(err, checker.IsNil, check.Commentf("Couldn't create image"))
|
2015-09-23 14:51:43 -04:00
|
|
|
|
|
|
|
dockerCmd(c, "tag", name, "labelfiltertest:tag1")
|
|
|
|
dockerCmd(c, "tag", name, "labelfiltertest:tag2")
|
|
|
|
dockerCmd(c, "tag", "busybox:latest", "labelfiltertest:tag3")
|
|
|
|
|
|
|
|
out, _ := dockerCmd(
|
|
|
|
c,
|
|
|
|
"events",
|
|
|
|
fmt.Sprintf("--since=%d", since),
|
|
|
|
fmt.Sprintf("--until=%d", daemonTime(c).Unix()),
|
2015-12-28 15:15:34 -05:00
|
|
|
"--filter", fmt.Sprintf("label=%s", label),
|
|
|
|
"--filter", "type=image")
|
2015-09-23 14:51:43 -04:00
|
|
|
|
|
|
|
events := strings.Split(strings.TrimSpace(out), "\n")
|
2015-10-16 11:54:05 -04:00
|
|
|
|
|
|
|
// 2 events from the "docker tag" command, another one is from "docker build"
|
2015-10-19 22:56:29 -04:00
|
|
|
c.Assert(events, checker.HasLen, 3, check.Commentf("Events == %s", events))
|
2015-09-23 14:51:43 -04:00
|
|
|
for _, e := range events {
|
|
|
|
c.Assert(e, checker.Contains, "labelfiltertest")
|
|
|
|
}
|
|
|
|
}
|
|
|
|
|
2015-04-18 12:46:47 -04:00
|
|
|
func (s *DockerSuite) TestEventsFilterContainer(c *check.C) {
|
|
|
|
since := fmt.Sprintf("%d", daemonTime(c).Unix())
|
2015-04-06 13:18:38 -04:00
|
|
|
nameID := make(map[string]string)
|
2015-02-09 01:03:42 -05:00
|
|
|
|
2015-04-06 13:18:38 -04:00
|
|
|
for _, name := range []string{"container_1", "container_2"} {
|
2015-07-20 02:55:40 -04:00
|
|
|
dockerCmd(c, "run", "--name", name, "busybox", "true")
|
2016-01-28 09:19:25 -05:00
|
|
|
id := inspectField(c, name, "Id")
|
2015-04-23 14:43:08 -04:00
|
|
|
nameID[name] = id
|
2015-02-09 01:03:42 -05:00
|
|
|
}
|
|
|
|
|
2015-04-18 12:46:47 -04:00
|
|
|
until := fmt.Sprintf("%d", daemonTime(c).Unix())
|
2015-02-09 01:03:42 -05:00
|
|
|
|
2015-04-06 13:18:38 -04:00
|
|
|
checkEvents := func(id string, events []string) error {
|
2015-05-24 14:19:39 -04:00
|
|
|
if len(events) != 4 { // create, attach, start, die
|
2015-09-23 14:51:43 -04:00
|
|
|
return fmt.Errorf("expected 4 events, got %v", events)
|
2015-04-06 13:18:38 -04:00
|
|
|
}
|
|
|
|
for _, event := range events {
|
2015-12-21 17:55:23 -05:00
|
|
|
matches := parseEventText(event)
|
|
|
|
if !matchEventID(matches, id) {
|
|
|
|
return fmt.Errorf("expected event for container id %s: %s - parsed container id: %s", id, event, matches["id"])
|
2015-04-06 13:18:38 -04:00
|
|
|
}
|
|
|
|
}
|
|
|
|
return nil
|
2015-02-09 01:03:42 -05:00
|
|
|
}
|
|
|
|
|
2015-04-06 13:18:38 -04:00
|
|
|
for name, ID := range nameID {
|
|
|
|
// filter by names
|
2015-07-20 02:55:40 -04:00
|
|
|
out, _ := dockerCmd(c, "events", "--since", since, "--until", until, "--filter", "container="+name)
|
2015-04-06 13:18:38 -04:00
|
|
|
events := strings.Split(strings.TrimSuffix(out, "\n"), "\n")
|
2015-10-19 22:56:29 -04:00
|
|
|
c.Assert(checkEvents(ID, events), checker.IsNil)
|
2015-03-30 23:26:27 -04:00
|
|
|
|
2015-04-06 13:18:38 -04:00
|
|
|
// filter by ID's
|
2015-07-20 02:55:40 -04:00
|
|
|
out, _ = dockerCmd(c, "events", "--since", since, "--until", until, "--filter", "container="+ID)
|
2015-04-06 13:18:38 -04:00
|
|
|
events = strings.Split(strings.TrimSuffix(out, "\n"), "\n")
|
2015-10-19 22:56:29 -04:00
|
|
|
c.Assert(checkEvents(ID, events), checker.IsNil)
|
2015-03-26 15:43:00 -04:00
|
|
|
}
|
|
|
|
}
|
2015-04-05 09:01:52 -04:00
|
|
|
|
2015-05-24 14:19:39 -04:00
|
|
|
func (s *DockerSuite) TestEventsCommit(c *check.C) {
|
2016-01-26 18:14:58 -05:00
|
|
|
// Problematic on Windows as cannot commit a running container
|
2015-08-28 13:36:42 -04:00
|
|
|
testRequires(c, DaemonIsLinux)
|
2015-05-24 14:19:39 -04:00
|
|
|
since := daemonTime(c).Unix()
|
|
|
|
|
2016-01-26 18:14:58 -05:00
|
|
|
out, _ := runSleepingContainer(c, "-d")
|
2015-05-24 14:19:39 -04:00
|
|
|
cID := strings.TrimSpace(out)
|
2015-10-19 22:56:29 -04:00
|
|
|
c.Assert(waitRun(cID), checker.IsNil)
|
2015-05-24 14:19:39 -04:00
|
|
|
|
2015-07-20 02:55:40 -04:00
|
|
|
dockerCmd(c, "commit", "-m", "test", cID)
|
|
|
|
dockerCmd(c, "stop", cID)
|
2015-05-24 14:19:39 -04:00
|
|
|
|
2015-07-20 02:55:40 -04:00
|
|
|
out, _ = dockerCmd(c, "events", "--since=0", "-f", "container="+cID, "--until="+strconv.Itoa(int(since)))
|
2015-12-21 17:55:23 -05:00
|
|
|
c.Assert(out, checker.Contains, "commit", check.Commentf("Missing 'commit' log event"))
|
2015-05-24 14:19:39 -04:00
|
|
|
}
|
|
|
|
|
|
|
|
func (s *DockerSuite) TestEventsCopy(c *check.C) {
|
|
|
|
since := daemonTime(c).Unix()
|
|
|
|
|
2015-05-14 16:44:29 -04:00
|
|
|
// Build a test image.
|
2015-05-24 14:19:39 -04:00
|
|
|
id, err := buildImage("cpimg", `
|
|
|
|
FROM busybox
|
2016-01-26 18:14:58 -05:00
|
|
|
RUN echo HI > /file`, true)
|
2015-10-19 22:56:29 -04:00
|
|
|
c.Assert(err, checker.IsNil, check.Commentf("Couldn't create image"))
|
2015-05-24 14:19:39 -04:00
|
|
|
|
2015-05-14 16:44:29 -04:00
|
|
|
// Create an empty test file.
|
|
|
|
tempFile, err := ioutil.TempFile("", "test-events-copy-")
|
2015-10-19 22:56:29 -04:00
|
|
|
c.Assert(err, checker.IsNil)
|
2015-05-14 16:44:29 -04:00
|
|
|
defer os.Remove(tempFile.Name())
|
|
|
|
|
2015-10-19 22:56:29 -04:00
|
|
|
c.Assert(tempFile.Close(), checker.IsNil)
|
2015-05-14 16:44:29 -04:00
|
|
|
|
|
|
|
dockerCmd(c, "create", "--name=cptest", id)
|
|
|
|
|
2016-01-26 18:14:58 -05:00
|
|
|
dockerCmd(c, "cp", "cptest:/file", tempFile.Name())
|
2015-05-24 14:19:39 -04:00
|
|
|
|
2015-07-20 02:55:40 -04:00
|
|
|
out, _ := dockerCmd(c, "events", "--since=0", "-f", "container=cptest", "--until="+strconv.Itoa(int(since)))
|
2015-12-21 17:55:23 -05:00
|
|
|
c.Assert(out, checker.Contains, "archive-path", check.Commentf("Missing 'archive-path' log event\n"))
|
2015-05-14 16:44:29 -04:00
|
|
|
|
2016-01-26 18:14:58 -05:00
|
|
|
dockerCmd(c, "cp", tempFile.Name(), "cptest:/filecopy")
|
2015-05-14 16:44:29 -04:00
|
|
|
|
|
|
|
out, _ = dockerCmd(c, "events", "--since=0", "-f", "container=cptest", "--until="+strconv.Itoa(int(since)))
|
2015-12-21 17:55:23 -05:00
|
|
|
c.Assert(out, checker.Contains, "extract-to-dir", check.Commentf("Missing 'extract-to-dir' log event"))
|
2015-05-24 14:19:39 -04:00
|
|
|
}
|
|
|
|
|
|
|
|
func (s *DockerSuite) TestEventsResize(c *check.C) {
|
|
|
|
since := daemonTime(c).Unix()
|
|
|
|
|
2015-07-20 02:55:40 -04:00
|
|
|
out, _ := dockerCmd(c, "run", "-d", "busybox", "top")
|
2015-05-24 14:19:39 -04:00
|
|
|
cID := strings.TrimSpace(out)
|
2015-10-19 22:56:29 -04:00
|
|
|
c.Assert(waitRun(cID), checker.IsNil)
|
2015-05-24 14:19:39 -04:00
|
|
|
|
|
|
|
endpoint := "/containers/" + cID + "/resize?h=80&w=24"
|
|
|
|
status, _, err := sockRequest("POST", endpoint, nil)
|
2015-10-19 22:56:29 -04:00
|
|
|
c.Assert(status, checker.Equals, http.StatusOK)
|
|
|
|
c.Assert(err, checker.IsNil)
|
2015-05-24 14:19:39 -04:00
|
|
|
|
2015-07-20 02:55:40 -04:00
|
|
|
dockerCmd(c, "stop", cID)
|
2015-05-24 14:19:39 -04:00
|
|
|
|
2015-07-20 02:55:40 -04:00
|
|
|
out, _ = dockerCmd(c, "events", "--since=0", "-f", "container="+cID, "--until="+strconv.Itoa(int(since)))
|
2015-12-21 17:55:23 -05:00
|
|
|
c.Assert(out, checker.Contains, "resize", check.Commentf("Missing 'resize' log event"))
|
2015-05-24 14:19:39 -04:00
|
|
|
}
|
|
|
|
|
|
|
|
func (s *DockerSuite) TestEventsAttach(c *check.C) {
|
2016-01-31 18:51:56 -05:00
|
|
|
// TODO Windows CI: Figure out why this test fails intermittently (TP4 and TP5).
|
|
|
|
testRequires(c, DaemonIsLinux)
|
2015-05-24 14:19:39 -04:00
|
|
|
since := daemonTime(c).Unix()
|
|
|
|
|
2016-01-26 18:14:58 -05:00
|
|
|
out, _ := dockerCmd(c, "run", "-di", "busybox", "cat")
|
2015-05-24 14:19:39 -04:00
|
|
|
cID := strings.TrimSpace(out)
|
|
|
|
|
|
|
|
cmd := exec.Command(dockerBinary, "attach", cID)
|
|
|
|
stdin, err := cmd.StdinPipe()
|
2015-10-19 22:56:29 -04:00
|
|
|
c.Assert(err, checker.IsNil)
|
2015-05-24 14:19:39 -04:00
|
|
|
defer stdin.Close()
|
|
|
|
stdout, err := cmd.StdoutPipe()
|
2015-10-19 22:56:29 -04:00
|
|
|
c.Assert(err, checker.IsNil)
|
2015-05-24 14:19:39 -04:00
|
|
|
defer stdout.Close()
|
2015-10-19 22:56:29 -04:00
|
|
|
c.Assert(cmd.Start(), checker.IsNil)
|
2015-05-24 14:19:39 -04:00
|
|
|
defer cmd.Process.Kill()
|
|
|
|
|
|
|
|
// Make sure we're done attaching by writing/reading some stuff
|
2015-10-19 22:56:29 -04:00
|
|
|
_, err = stdin.Write([]byte("hello\n"))
|
|
|
|
c.Assert(err, checker.IsNil)
|
2015-05-24 14:19:39 -04:00
|
|
|
out, err = bufio.NewReader(stdout).ReadString('\n')
|
2015-10-19 22:56:29 -04:00
|
|
|
c.Assert(err, checker.IsNil)
|
|
|
|
c.Assert(strings.TrimSpace(out), checker.Equals, "hello", check.Commentf("expected 'hello'"))
|
2015-05-24 14:19:39 -04:00
|
|
|
|
2015-10-19 22:56:29 -04:00
|
|
|
c.Assert(stdin.Close(), checker.IsNil)
|
2015-05-24 14:19:39 -04:00
|
|
|
|
2016-01-25 21:45:45 -05:00
|
|
|
dockerCmd(c, "kill", cID)
|
2015-05-24 14:19:39 -04:00
|
|
|
|
2015-07-20 02:55:40 -04:00
|
|
|
out, _ = dockerCmd(c, "events", "--since=0", "-f", "container="+cID, "--until="+strconv.Itoa(int(since)))
|
2015-12-21 17:55:23 -05:00
|
|
|
c.Assert(out, checker.Contains, "attach", check.Commentf("Missing 'attach' log event"))
|
2015-05-24 14:19:39 -04:00
|
|
|
}
|
|
|
|
|
|
|
|
func (s *DockerSuite) TestEventsRename(c *check.C) {
|
|
|
|
since := daemonTime(c).Unix()
|
|
|
|
|
2015-07-20 02:55:40 -04:00
|
|
|
dockerCmd(c, "run", "--name", "oldName", "busybox", "true")
|
|
|
|
dockerCmd(c, "rename", "oldName", "newName")
|
2015-05-24 14:19:39 -04:00
|
|
|
|
2015-07-20 02:55:40 -04:00
|
|
|
out, _ := dockerCmd(c, "events", "--since=0", "-f", "container=newName", "--until="+strconv.Itoa(int(since)))
|
2015-12-21 17:55:23 -05:00
|
|
|
c.Assert(out, checker.Contains, "rename", check.Commentf("Missing 'rename' log event\n"))
|
2015-05-24 14:19:39 -04:00
|
|
|
}
|
|
|
|
|
|
|
|
func (s *DockerSuite) TestEventsTop(c *check.C) {
|
2016-01-26 18:14:58 -05:00
|
|
|
// Problematic on Windows as Windows does not support top
|
2015-08-28 13:36:42 -04:00
|
|
|
testRequires(c, DaemonIsLinux)
|
2015-05-24 14:19:39 -04:00
|
|
|
since := daemonTime(c).Unix()
|
|
|
|
|
2016-01-26 18:14:58 -05:00
|
|
|
out, _ := runSleepingContainer(c, "-d")
|
2015-05-24 14:19:39 -04:00
|
|
|
cID := strings.TrimSpace(out)
|
2015-10-19 22:56:29 -04:00
|
|
|
c.Assert(waitRun(cID), checker.IsNil)
|
2015-05-24 14:19:39 -04:00
|
|
|
|
2015-07-20 02:55:40 -04:00
|
|
|
dockerCmd(c, "top", cID)
|
|
|
|
dockerCmd(c, "stop", cID)
|
2015-05-24 14:19:39 -04:00
|
|
|
|
2015-07-20 02:55:40 -04:00
|
|
|
out, _ = dockerCmd(c, "events", "--since=0", "-f", "container="+cID, "--until="+strconv.Itoa(int(since)))
|
2015-12-21 17:55:23 -05:00
|
|
|
c.Assert(out, checker.Contains, " top", check.Commentf("Missing 'top' log event"))
|
2015-05-24 14:19:39 -04:00
|
|
|
}
|
2015-06-04 22:47:46 -04:00
|
|
|
|
|
|
|
// #13753
|
|
|
|
func (s *DockerSuite) TestEventsDefaultEmpty(c *check.C) {
|
2015-07-06 23:27:00 -04:00
|
|
|
dockerCmd(c, "run", "busybox")
|
2015-06-04 22:47:46 -04:00
|
|
|
out, _ := dockerCmd(c, "events", fmt.Sprintf("--until=%d", daemonTime(c).Unix()))
|
2015-10-19 22:56:29 -04:00
|
|
|
c.Assert(strings.TrimSpace(out), checker.Equals, "")
|
2015-06-04 22:47:46 -04:00
|
|
|
}
|
2015-07-03 17:26:49 -04:00
|
|
|
|
|
|
|
// #14316
|
|
|
|
func (s *DockerRegistrySuite) TestEventsImageFilterPush(c *check.C) {
|
2016-01-26 18:14:58 -05:00
|
|
|
// Problematic to port for Windows CI during TP4/TP5 timeframe while
|
|
|
|
// not supporting push
|
2015-08-28 13:36:42 -04:00
|
|
|
testRequires(c, DaemonIsLinux)
|
2015-07-03 17:26:49 -04:00
|
|
|
testRequires(c, Network)
|
|
|
|
since := daemonTime(c).Unix()
|
|
|
|
repoName := fmt.Sprintf("%v/dockercli/testf", privateRegistryURL)
|
|
|
|
|
2015-07-20 02:55:40 -04:00
|
|
|
out, _ := dockerCmd(c, "run", "-d", "busybox", "top")
|
2015-07-03 17:26:49 -04:00
|
|
|
cID := strings.TrimSpace(out)
|
2015-10-19 22:56:29 -04:00
|
|
|
c.Assert(waitRun(cID), checker.IsNil)
|
2015-07-03 17:26:49 -04:00
|
|
|
|
|
|
|
dockerCmd(c, "commit", cID, repoName)
|
|
|
|
dockerCmd(c, "stop", cID)
|
|
|
|
dockerCmd(c, "push", repoName)
|
|
|
|
|
2015-07-20 02:55:40 -04:00
|
|
|
out, _ = dockerCmd(c, "events", "--since=0", "-f", "image="+repoName, "-f", "event=push", "--until="+strconv.Itoa(int(since)))
|
2015-12-21 17:55:23 -05:00
|
|
|
c.Assert(out, checker.Contains, repoName, check.Commentf("Missing 'push' log event for %s", repoName))
|
2015-07-03 17:26:49 -04:00
|
|
|
}
|
2015-12-28 15:15:34 -05:00
|
|
|
|
|
|
|
func (s *DockerSuite) TestEventsFilterType(c *check.C) {
|
|
|
|
since := daemonTime(c).Unix()
|
|
|
|
name := "labelfiltertest"
|
|
|
|
label := "io.docker.testing=image"
|
|
|
|
|
|
|
|
// Build a test image.
|
|
|
|
_, err := buildImage(name, fmt.Sprintf(`
|
|
|
|
FROM busybox:latest
|
|
|
|
LABEL %s`, label), true)
|
|
|
|
c.Assert(err, checker.IsNil, check.Commentf("Couldn't create image"))
|
|
|
|
|
|
|
|
dockerCmd(c, "tag", name, "labelfiltertest:tag1")
|
|
|
|
dockerCmd(c, "tag", name, "labelfiltertest:tag2")
|
|
|
|
dockerCmd(c, "tag", "busybox:latest", "labelfiltertest:tag3")
|
|
|
|
|
|
|
|
out, _ := dockerCmd(
|
|
|
|
c,
|
|
|
|
"events",
|
|
|
|
fmt.Sprintf("--since=%d", since),
|
|
|
|
fmt.Sprintf("--until=%d", daemonTime(c).Unix()),
|
|
|
|
"--filter", fmt.Sprintf("label=%s", label),
|
|
|
|
"--filter", "type=image")
|
|
|
|
|
|
|
|
events := strings.Split(strings.TrimSpace(out), "\n")
|
|
|
|
|
|
|
|
// 2 events from the "docker tag" command, another one is from "docker build"
|
|
|
|
c.Assert(events, checker.HasLen, 3, check.Commentf("Events == %s", events))
|
|
|
|
for _, e := range events {
|
|
|
|
c.Assert(e, checker.Contains, "labelfiltertest")
|
|
|
|
}
|
|
|
|
|
|
|
|
out, _ = dockerCmd(
|
|
|
|
c,
|
|
|
|
"events",
|
|
|
|
fmt.Sprintf("--since=%d", since),
|
|
|
|
fmt.Sprintf("--until=%d", daemonTime(c).Unix()),
|
|
|
|
"--filter", fmt.Sprintf("label=%s", label),
|
|
|
|
"--filter", "type=container")
|
|
|
|
events = strings.Split(strings.TrimSpace(out), "\n")
|
|
|
|
|
|
|
|
// Events generated by the container that builds the image
|
|
|
|
c.Assert(events, checker.HasLen, 3, check.Commentf("Events == %s", events))
|
|
|
|
|
|
|
|
out, _ = dockerCmd(
|
|
|
|
c,
|
|
|
|
"events",
|
|
|
|
fmt.Sprintf("--since=%d", since),
|
|
|
|
fmt.Sprintf("--until=%d", daemonTime(c).Unix()),
|
|
|
|
"--filter", "type=network")
|
|
|
|
events = strings.Split(strings.TrimSpace(out), "\n")
|
|
|
|
c.Assert(len(events), checker.GreaterOrEqualThan, 1, check.Commentf("Events == %s", events))
|
|
|
|
}
|
|
|
|
|
|
|
|
func (s *DockerSuite) TestEventsFilterImageInContainerAction(c *check.C) {
|
|
|
|
since := daemonTime(c).Unix()
|
|
|
|
dockerCmd(c, "run", "--name", "test-container", "-d", "busybox", "true")
|
|
|
|
waitRun("test-container")
|
|
|
|
|
|
|
|
out, _ := dockerCmd(c, "events", "--filter", "image=busybox", fmt.Sprintf("--since=%d", since), fmt.Sprintf("--until=%d", daemonTime(c).Unix()))
|
|
|
|
events := strings.Split(strings.TrimSpace(out), "\n")
|
|
|
|
c.Assert(len(events), checker.GreaterThan, 1, check.Commentf(out))
|
|
|
|
}
|