You are viewing a plain text version of this content. The canonical link for it is here.
Posted to dev@geode.apache.org by Helena Bales <hb...@pivotal.io> on 2018/09/10 23:06:17 UTC

Awaitility may time out before evaluating the condition

Hello All,

Dale and I encountered an interesting Awaitility bug where an Awaitility
using "untilAsserted" timed out before it evaluated the condition. It
appears that Awaitility starts its timer before the thread has completely
started, and when the duration specified in "atMost" is reached, a
TimeoutException is thrown regardless of how much of the runnable/callable
has executed.

In the situation we encountered, an Awaitility had a duration of 1 second
and contained an assertion. The error that we saw was a TimeoutException
without a cause. When we had the same assertion before the failing
Awaitility, the assertion passed, then the awaitility failed. Increasing
the duration fixed this issue.

*tl;dr*
If you're getting TimeoutExceptions where you shouldn't be, check that your
"atMost" is long enough for the Awaitility thread to start AND your
conditions to be evaluated at least once.

-Helena and Dale