Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Rewrite test_logging_throttle tests #167

Merged
merged 1 commit into from
Jul 4, 2019

Conversation

jpsamper2009
Copy link
Contributor

@jpsamper2009 jpsamper2009 commented Jun 28, 2019

  • The old test is basically trying to write logs, dropping the ones that come too often. In this case, it is writing 10 logs every 30 ms, but only allowing one every 50 ms:
R = Received
T = Throttled
0 <-- 30 ms --> 1 <-- 30 ms --> 2 <-- 30 ms --> 3...
R               T               R               T 
|----- 50 ms ------------>      |----- 50 ms ------------>

However, if the 30 ms sleep jitters and/or the RCUTILS call takes too long, then the a log that should have been dropped, doesn't actually get dropped:

R = Received
T = Throttled
0 <-- RCUTILS_LOG -> <-- 30 ms --> 1 <-- 30 ms --> 2 <-- 30 ms --> 3...
R                                  R <--- Should be throttled 
|----- 50 ms ------------>         |----- 50 ms ------------>

This PR changes the test in a way that it is not subject to timing discrepancies:

R = Received
T = Throttled
first  < ~5 ms > other < ~5 ms > other < ~5 ms > ... < ~5 ms > other
R                T               T             T ... T         R      
|----- 200 ms --------------------------------------------->

In this case, we are testing that after receiving the first log call, no more logs are written until
the throttle time (or longer) has elapsed. This test is more robust than the old one because it doesn't make an assumption about how many logs get throttled to get the number received, but
instead checks that the second log is received only after we are certain that the throttle timeout has occurred

- Make test robust to timing discrepancies

Signed-off-by: Juan Pablo Samper <jp.samper@apex.ai>
@jpsamper2009 jpsamper2009 force-pushed the fix-test-logging-throttle branch from 8c6aee7 to c238177 Compare June 28, 2019 21:42
Copy link
Member

@jacobperron jacobperron left a comment

Choose a reason for hiding this comment

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

LGTM. Thanks for the patch!

  • Linux Build Status
  • Linux-aarch64 Build Status
  • macOS Build Status
  • Windows Build Status

@jacobperron jacobperron merged commit 2497ff5 into ros2:master Jul 4, 2019
@ros-discourse
Copy link

This pull request has been mentioned on ROS Discourse. There might be relevant details there:

https://discourse.ros.org/t/tackling-of-flaky-tests/13686/1

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

Successfully merging this pull request may close these issues.

3 participants