=tes #15167 Harden TestTimeSpec
This commit is contained in:
parent
2a252fa2fb
commit
4e54672198
1 changed files with 4 additions and 4 deletions
|
|
@ -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 {
|
||||
|
|
|
|||
Loading…
Add table
Add a link
Reference in a new issue