Merge pull request #26500 from chbatey/issue-25964

Harden InactiveEntityPassivationSpec
This commit is contained in:
Patrik Nordwall 2019-04-02 09:15:13 +02:00 committed by GitHub
commit 08abca7956
No known key found for this signature in database
GPG key ID: 4AEE18F83AFDEB23

View file

@ -53,6 +53,8 @@ object InactiveEntityPassivationSpec {
class InactiveEntityPassivationSpec extends AkkaSpec(InactiveEntityPassivationSpec.config) {
import InactiveEntityPassivationSpec._
val smallTolerance = 300.millis
"Passivation of inactive entities" must {
"passivate entities when they haven't seen messages for the configured duration" in {
@ -83,7 +85,8 @@ class InactiveEntityPassivationSpec extends AkkaSpec(InactiveEntityPassivationSp
// make sure "1" hasn't seen a message in 3 seconds and passivates
val timeSinceOneSawAMessage = (System.nanoTime() - timeOneSawMessage).nanos
probe.expectNoMessage(3.seconds - timeSinceOneSawAMessage)
val timeUntilPassivate: FiniteDuration = (3.seconds - timeSinceOneSawAMessage) - smallTolerance
probe.expectNoMessage(timeUntilPassivate)
probe.expectMsg("1 passivating")
// but it can be re activated just fine: