Skip to content

Make TestEventsFilterLabels less flaky#38552

Merged
vdemeester merged 1 commit intomoby:masterfrom
thaJeztah:improve_test_events_filter_labels
Jan 15, 2019
Merged

Make TestEventsFilterLabels less flaky#38552
vdemeester merged 1 commit intomoby:masterfrom
thaJeztah:improve_test_events_filter_labels

Conversation

@thaJeztah
Copy link
Member

fixes #22814

This test sometimes failed because the number of events received did not
match the expected number:

FAIL: docker_cli_events_test.go:316: DockerSuite.TestEventsFilterLabels

docker_cli_events_test.go:334:
    c.Assert(len(events), checker.Equals, 3)
... obtained int = 2
... expected int = 3

This patch makes the test more stable, by:

  • use a wider range between --since and --until. These options were set
    so that the client detaches after events were received, but the actual
    range should not matter. Changing the range will cause more events to be
    returned, but we're specifically looking for the container ID's, so this
    should not make a difference for the actual test.
  • use docker create instead of docker run for the containers. the
    containers don't have to be running to trigger an event; using create
    speeds up the test.
  • check the exit code of the docker create to verify the containers were
    succesfully created.

@thaJeztah
Copy link
Member Author

oh, dang; forgot to update a value again lol

19:45:31 FAIL: docker_cli_events_test.go:317: DockerSuite.TestEventsFilterLabels
19:45:31 
19:45:31 docker_cli_events_test.go:341:
19:45:31     c.Assert(len(events), checker.GreaterThan, 2)
19:45:31 ... obtained int = 1
19:45:31 ... expected int = 2
19:45:31 

@thaJeztah thaJeztah force-pushed the improve_test_events_filter_labels branch from 15c4101 to 92dca65 Compare January 13, 2019 20:03
@codecov
Copy link

codecov bot commented Jan 13, 2019

Codecov Report

❗ No coverage uploaded for pull request base (master@ebc0750). Click here to learn what that means.
The diff coverage is n/a.

@@            Coverage Diff            @@
##             master   #38552   +/-   ##
=========================================
  Coverage          ?   36.65%           
=========================================
  Files             ?      608           
  Lines             ?    45173           
  Branches          ?        0           
=========================================
  Hits              ?    16557           
  Misses            ?    26333           
  Partials          ?     2283

@thaJeztah
Copy link
Member Author

hmmm.. forgot that it will now wait for the "until" time to expire;

updating

@thaJeztah thaJeztah force-pushed the improve_test_events_filter_labels branch from 92dca65 to b9fc518 Compare January 13, 2019 23:22
This test sometimes failed because the number of events received did not
match the expected number:

    FAIL: docker_cli_events_test.go:316: DockerSuite.TestEventsFilterLabels

    docker_cli_events_test.go:334:
        c.Assert(len(events), checker.Equals, 3)
    ... obtained int = 2
    ... expected int = 3

This patch makes the test more stable, by:

- use a wider range between `--since` and `--until`. These options were set
  so that the client detaches after events were received, but the actual
  range should not matter. Changing the range will cause more events to be
  returned, but we're specifically looking for the container ID's, so this
  should not make a difference for the actual test.
- use `docker create` instead of `docker run` for the containers. the
  containers don't have to be running to trigger an event; using `create`
  speeds up the test.
- check the exit code of the `docker create` to verify the containers were
  succesfully created.

Signed-off-by: Sebastiaan van Stijn <[email protected]>
@thaJeztah thaJeztah force-pushed the improve_test_events_filter_labels branch from b9fc518 to 0e15c02 Compare January 13, 2019 23:29
Copy link
Member

@vdemeester vdemeester left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

LGTM 🐯

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Projects

None yet

Development

Successfully merging this pull request may close these issues.

Flaky test: TestEventsFilterLabels

4 participants