From b7ad3e7ea10e285226a0a5b1665e8205b3264128 Mon Sep 17 00:00:00 2001 From: Sebastiaan van Stijn Date: Wed, 20 Dec 2017 12:40:05 +0100 Subject: [PATCH] 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 in ddae20c032058a0fd42c34c2e9750ee8f62) 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 in 8d056423f8c433927089bd7eb6bc97abbc1ed502, 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 --- integration-cli/docker_cli_events_test.go | 44 ----------------------- 1 file changed, 44 deletions(-) diff --git a/integration-cli/docker_cli_events_test.go b/integration-cli/docker_cli_events_test.go index dff54a4463..b75dcc1512 100644 --- a/integration-cli/docker_cli_events_test.go +++ b/integration-cli/docker_cli_events_test.go @@ -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")