-
-
Notifications
You must be signed in to change notification settings - Fork 286
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
Stop Eventually/Consistently with success #786
Comments
hey - this makes sense, though really only for |
thx! :D |
do you mind if I use your example in the docs? |
go ahead 👍 |
alrighty, this is pushed now. will cut a release oon |
thank you 🎉 |
FYI using this wrapper func ConsistentlyUntil[T any](fn func() T, timeout any, interval any, errChan chan error) AsyncAssertion {
return Consistently(func() T {
select {
case err := <-errChan:
if err == nil {
StopTrying("success!").Successfully().Now()
}
StopTrying(fmt.Sprintf("background task faild: %v", err)).Now()
return fn() // unreachable since StopTrying will panic
default:
return fn()
}
}, timeout, interval)
} |
ooh that's nice. glad it's proven useful :) |
as per https://onsi.github.io/gomega/#bailing-out-early
StopTrying
is the only way to stop iteration without having to implement a custom matcherbut I'd like to also stop with a success, for example
to not fail, for example with
StopTrying("background task stopped").Success()
or return
return true, StopTrying("background task stopped").Success()
The text was updated successfully, but these errors were encountered: