Merge pull request #15637 from akka/wip-15167-TestTimeSpec-patriknw

=tes #15167 Harden TestTimeSpec
This commit is contained in:
Patrik Nordwall 2014-08-11 20:18:28 +02:00
commit d963f6e981

View file

@ -13,11 +13,11 @@ class TestTimeSpec extends AkkaSpec(Map("akka.test.timefactor" -> 2.0)) {
val probe = TestProbe()
val now = System.nanoTime
intercept[AssertionError] { probe.awaitCond(false, Duration("1 second")) }
intercept[AssertionError] { probe.awaitCond(false, 1.second) }
val diff = System.nanoTime - now
val target = (1000000000l * testKitSettings.TestTimeFactor).toLong
diff should be > (target - 500000000l)
diff should be < (target + 500000000l)
val target = (1000000000L * testKitSettings.TestTimeFactor).toLong
diff should be >= target
diff should be < (target + 1000000000L) // 1 s margin for GC
}
"awaitAssert must throw correctly" in {