|
@@ -81,50 +81,6 @@ func (s *DockerSuite) TestEventsUntag(c *check.C) {
|
|
|
}
|
|
|
}
|
|
|
|
|
|
-func (s *DockerSuite) TestEventsLimit(c *check.C) {
|
|
|
- // Windows: Limit to 4 goroutines creating containers in order to prevent
|
|
|
- // timeouts creating so many containers simultaneously. This is a due to
|
|
|
- // a bug in the Windows platform. It will be fixed in a Windows Update.
|
|
|
- numContainers := 17
|
|
|
- eventPerContainer := 7 // create, attach, network connect, start, die, network disconnect, destroy
|
|
|
- numConcurrentContainers := numContainers
|
|
|
- if testEnv.DaemonPlatform() == "windows" {
|
|
|
- numConcurrentContainers = 4
|
|
|
- }
|
|
|
- sem := make(chan bool, numConcurrentContainers)
|
|
|
- errChan := make(chan error, numContainers)
|
|
|
-
|
|
|
- startTime := daemonUnixTime(c)
|
|
|
-
|
|
|
- args := []string{"run", "--rm", "busybox", "true"}
|
|
|
- for i := 0; i < numContainers; i++ {
|
|
|
- sem <- true
|
|
|
- go func(i int) {
|
|
|
- defer func() { <-sem }()
|
|
|
- out, err := exec.Command(dockerBinary, args...).CombinedOutput()
|
|
|
- if err != nil {
|
|
|
- err = fmt.Errorf("%v: %s", err, string(out))
|
|
|
- }
|
|
|
- errChan <- err
|
|
|
- }(i)
|
|
|
- }
|
|
|
-
|
|
|
- // Wait for all goroutines to finish
|
|
|
- for i := 0; i < cap(sem); i++ {
|
|
|
- sem <- true
|
|
|
- }
|
|
|
- close(errChan)
|
|
|
-
|
|
|
- for err := range errChan {
|
|
|
- c.Assert(err, checker.IsNil, check.Commentf("%q failed with error", strings.Join(args, " ")))
|
|
|
- }
|
|
|
-
|
|
|
- out, _ := dockerCmd(c, "events", "--since="+startTime, "--until", daemonUnixTime(c))
|
|
|
- events := strings.Split(out, "\n")
|
|
|
- nEvents := len(events) - 1
|
|
|
- c.Assert(nEvents, checker.Equals, numContainers*eventPerContainer, check.Commentf("events should be limited to 256, but received %d", nEvents))
|
|
|
-}
|
|
|
-
|
|
|
func (s *DockerSuite) TestEventsContainerEvents(c *check.C) {
|
|
|
dockerCmd(c, "run", "--rm", "--name", "container-events-test", "busybox", "true")
|
|
|
|