=tes #15167 Harden TestTimeSpec

This commit is contained in:
Patrik Nordwall 2014-08-07 11:58:44 +02:00
parent 2a252fa2fb
commit 4e54672198

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 {