-
-
Notifications
You must be signed in to change notification settings - Fork 296
Closed
Description
as per https://onsi.github.io/gomega/#bailing-out-early
StopTrying
is the only way to stop iteration without having to implement a custom matcher
but I'd like to also stop with a success, for example
errChan := make(chan error)
go func() {
time.Sleep(10 * time.Second)
errChan <- fmt.Errorf("error")
}()
Consistently(func() (bool) {
select {
case err := <-errChan:
StopTrying("background task finished").Now()
return true
default:
return true // actual check goes here
}
}, timeout, interval).Should(BeTrue())
to not fail, for example with StopTrying("background task stopped").Success()
or return return true, StopTrying("background task stopped").Success()
Metadata
Metadata
Assignees
Labels
No labels