mirror of
https://github.com/moby/moby.git
synced 2022-11-09 12:21:53 -05:00
Remove TestEventsLimit()
This test was added a long time ago, and over the years has proven to be flaky, and slow. To address those issues, it was modified to; - cleanup containers afterwards - take clock-skew into account - improve performance by parallelizing the container runs - _reduce_ parallelization to address platform issues on Windows (twice..) - adjust the test to take new limits into account - adjust the test to account for more events being generated by containers The last change to this test (made inddae20c032
) actually broke the test, as it's now testing that all events sent by containers (`numContainers*eventPerContainer`) are received, but the number of events that is generated (17 containers * 7 events = 119) is less than the limit (256 events). The limit is already covered by the `TestLogEvents` unit-test, that was added in8d056423f8
, and tests that the number of events is limited to `eventsLimit`. This patch removes the test, because it's not needed. Signed-off-by: Sebastiaan van Stijn <github@gone.nl>
This commit is contained in:
parent
c492e76d13
commit
b7ad3e7ea1
1 changed files with 0 additions and 44 deletions
|
@ -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) {
|
func (s *DockerSuite) TestEventsContainerEvents(c *check.C) {
|
||||||
dockerCmd(c, "run", "--rm", "--name", "container-events-test", "busybox", "true")
|
dockerCmd(c, "run", "--rm", "--name", "container-events-test", "busybox", "true")
|
||||||
|
|
||||||
|
|
Loading…
Add table
Reference in a new issue