These are chat archives for etorreborre/specs2

15th
Feb 2017
Joao Azevedo
@jcazevedo
Feb 15 2017 16:36
Hi!
What's the meaning of retries in the await helper?
More specifically, if I have something like:
def foo = Future { Thread.sleep(100); println("running"); 1 }
foo must beEqualTo(0).await(5, 1.seconds)
Shouldn't foo be called 5 times?
Eric Torreborre
@etorreborre
Feb 15 2017 16:41
yes I think so
Joao Azevedo
@jcazevedo
Feb 15 2017 16:42
Well, it isn't.
I'm on 3.8.7.
Eric Torreborre
@etorreborre
Feb 15 2017 16:43
It might be a bug, I will check that
Joao Azevedo
@jcazevedo
Feb 15 2017 16:46
I can try to look at it. I was just making sure I wasn't understanding the semantic of retries wrong.
Eric Torreborre
@etorreborre
Feb 15 2017 16:47
You can look into org.specs2.concurrent.FutureAwait
Joao Azevedo
@jcazevedo
Feb 15 2017 17:18
@etorreborre: looking at FutureAwait, it seems like await is only expected to retry in case of a TimeoutException
Even if that is the expected behaviour, there's a bug there.
Eric Torreborre
@etorreborre
Feb 15 2017 17:19
oh, right, I read it wrong it is indeed to be able to wait several times for something which could time out
if you want to retry an action which could return different results you can use eventually
see org.specs2.matcher.EventuallyMatchers
or org.specs2.execute.EventuallyResults
Joao Azevedo
@jcazevedo
Feb 15 2017 17:21
Still, it isn't retrying in case of a timeout. I'll open a PR with a fix.
Eric Torreborre
@etorreborre
Feb 15 2017 17:32
ok thanks I'm curious because this used to work
Joao Azevedo
@jcazevedo
Feb 15 2017 18:20
@etorreborre: I've opened #549 with a proposal for the fix.