Rewrite test_logging_throttle tests #167
Merged
Add this suggestion to a batch that can be applied as a single commit.
This suggestion is invalid because no changes were made to the code.
Suggestions cannot be applied while the pull request is closed.
Suggestions cannot be applied while viewing a subset of changes.
Only one suggestion per line can be applied in a batch.
Add this suggestion to a batch that can be applied as a single commit.
Applying suggestions on deleted lines is not supported.
You must change the existing code in this line in order to create a valid suggestion.
Outdated suggestions cannot be applied.
This suggestion has been applied or marked resolved.
Suggestions cannot be applied from pending reviews.
Suggestions cannot be applied on multi-line comments.
Suggestions cannot be applied while the pull request is queued to merge.
Suggestion cannot be applied right now. Please check back later.
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:
This PR changes the test in a way that it is not subject to timing discrepancies:
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