test_utils: macro for waiting on condition #12586
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.
Currently we have cooperative_spin_wait_with_timeout that throws if a condition
isn't met after a given timeout. The way this typically shows up in tests is
the exception is caught by the test fiber, the test's destructor is called, and
the generic timeout exception is logged after everything is cleaned up. This
makes it difficult to track down issues because it's rarely clear what timed
out.
This patch adds a new boost_require_eventually macro to BOOST_FAIL on timeout,
indicating the log line that failed.
Tests that use this will timeout like:
Instead of logs like below that don't indicate what timed out:
I don't love that boost permeates the interface, but until we move to
another test framework, it seems reasonable to tie the implementation
and the macro name to boost.
Backports Required
Release Notes