testify
testify copied to clipboard
assert: check early in Eventually, EventuallyWithT, and Never
Summary
Addresses #1424.
Eventually
and EventuallyWithT
current must always wait at least the polling duration before they can succeed. This PR starts checking the condition immediately. The assertion still fails if the initial check of the condition takes longer than the configured timeout.
Changes
Motivation
This will provide a small optimization to callers, because tests can complete more quickly than they did before if conditions are met already.
Related issues
This PR changes more than what it claims.
Please keep it focused on #1424 and move the changes related to the tick separately. Because it seems that runs of the condition will not overlap anymore.
@dolmen What more does it change? The changes I made to the tick here are to facilitate addressing #1424. How would you do it differently?
#1439 could also address this issue. @dolmen what are your thoughts on this PR's approach vs. addressing #1439 instead?
I intend to merge #1395 first. Could you help with your own review now, and we will work on your own changes after the merge?
@dolmen After #1395, I think we should pursue either the approach in this PR or the approach outlined in #1439, but not both. I will wait until we have the input needed to decide on #1439
@cszczepaniak I just merged #1481 which uses runtime.Goexit
. The single goroutine approach is incompatible.
@dolmen sounds good. I don't think that affects this PR, though.
@cszczepaniak Please rebase as this requires to resolve merge conflicts.
@dolmen Thanks, I've rebased now.