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

tests: net: conn_mgr_monitor: Improve test reliability under heavy load #79710

Conversation

rlubos
Copy link
Contributor

@rlubos rlubos commented Oct 11, 2024

conn_mgr_tests were occasionally failing when executed under heavy load. The reason for this are short timeout values used when waiting for events - if executed under heavy load, the even might not be delivered on time.

An obvious solution would be to simply increase the timeout, however when testing it turned out the actual timeout value would need to be pretty high to ensure tests reliability. Therefore, to avoid unnecessary increase of the overall test execution time to protect against rare edge cases, rework the event waiting mechanism to use semaphore instead. The test cases will now specify the events they're waiting for, and the event handlers will feed the semaphore if all expected events have been delivered. This allows the increase the maximum timeout when waiting for events, w/o affecting too much the test execution time under normal conditions.

conn_mgr_tests were occasionally failing when executed under heavy load.
The reason for this are short timeout values used when waiting for
events - if executed under heavy load, the even might not be delivered
on time.

An obvious solution would be to simply increase the timeout, however
when testing it turned out the actual timeout value would need to be
pretty high to ensure tests reliability. Therefore, to avoid
unnecessary increase of the overall test execution time to protect
against rare edge cases, rework the event waiting mechanism to use
semaphore instead. The test cases will now specify the events they're
waiting for, and the event handlers will feed the semaphore if all
expected events have been delivered. This allows the increase the
maximum timeout when waiting for events, w/o affecting too much the test
execution time under normal conditions.

Signed-off-by: Robert Lubos <[email protected]>
Copy link
Contributor

@glarsennordic glarsennordic 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 this

@carlescufi carlescufi merged commit 45a79d3 into zephyrproject-rtos:main Oct 15, 2024
20 checks passed
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.

6 participants