Make test conductor barriers fail for all on timeouts and care about within() blocks. See #2218

This commit is contained in:
Björn Antonsson 2012-06-13 13:52:58 +02:00
parent 8d12385a3e
commit 463e62926e
8 changed files with 303 additions and 109 deletions

View file

@ -158,7 +158,13 @@ trait TestKitBase {
* block or missing that it returns the properly dilated default for this
* case from settings (key "akka.test.single-expect-default").
*/
def remaining: Duration = if (end == Duration.Undefined) testKitSettings.SingleExpectDefaultTimeout.dilated else end - now
def remaining: Duration = remainingOr(testKitSettings.SingleExpectDefaultTimeout.dilated)
/**
* Obtain time remaining for execution of the innermost enclosing `within`
* block or missing that it returns the given duration.
*/
def remainingOr(duration: Duration): Duration = if (end == Duration.Undefined) duration else end - now
/**
* Query queue status.
@ -605,12 +611,6 @@ object TestKit {
/**
* Await until the given condition evaluates to `true` or the timeout
* expires, whichever comes first.
*
* If no timeout is given, take it from the innermost enclosing `within`
* block.
*
* Note that the timeout is scaled using Duration.dilated, which uses the
* configuration entry "akka.test.timefactor"
*/
def awaitCond(p: Boolean, max: Duration, interval: Duration = 100.millis, noThrow: Boolean = false): Boolean = {
val stop = now + max