testify
testify copied to clipboard
Check condition immediately in *.Eventually
Summary
assert.Eventually
waits for the tick interval before doing the first check of the condition. In a lot of cases, the condition might be true immediately, so it would be helpful to check it right away..
Changes
- Return early from
assert.Eventually
if the condition is already met. This will also affectrequire.Eventually
.
Motivation
This change avoids unnecessary waiting and allocations if the condition is true immediately -- it precludes us needing to set up a ticker, timer, and channel. This can save a lot of time when running tests repeatedly.