Avoid ActorsLeakSpec failure (#30539)

* Avoid ActorsLeakSpec failure

Would fail when we see two termination warnings right
after each other. It would be nicer if we could add a
flag to ignore excess messages like we have in the
typed testkit, but it doesn't seem worth it to overhaul
the API to add that.

Fixes #25316

* Await.ready -> Await.result
This commit is contained in:
Arnout Engelen 2021-08-18 08:59:41 +02:00 committed by GitHub
parent b7d0ef6526
commit 4c732e9865
No known key found for this signature in database
GPG key ID: 4AEE18F83AFDEB23

View file

@ -104,7 +104,7 @@ class ActorsLeakSpec extends AkkaSpec(ActorsLeakSpec.config) with ImplicitSender
remoteSystem.terminate()
}
Await.ready(remoteSystem.whenTerminated, 10.seconds)
Await.result(remoteSystem.whenTerminated, 10.seconds)
}
// Quarantine an old incarnation case
@ -147,7 +147,7 @@ class ActorsLeakSpec extends AkkaSpec(ActorsLeakSpec.config) with ImplicitSender
remoteSystem.terminate()
}
Await.ready(remoteSystem.whenTerminated, 10.seconds)
Await.result(remoteSystem.whenTerminated, 10.seconds)
}
@ -170,14 +170,14 @@ class ActorsLeakSpec extends AkkaSpec(ActorsLeakSpec.config) with ImplicitSender
probe.expectMsgType[ActorIdentity].ref.nonEmpty should be(true)
// This will make sure that no SHUTDOWN message gets through
Await.ready(RARP(system).provider.transport.managementCommand(ForceDisassociate(remoteAddress)), 3.seconds)
Await.result(RARP(system).provider.transport.managementCommand(ForceDisassociate(remoteAddress)), 3.seconds)
} finally {
remoteSystem.terminate()
}
EventFilter.warning(pattern = "Association with remote system", occurrences = 1).intercept {
Await.ready(remoteSystem.whenTerminated, 10.seconds)
Await.result(remoteSystem.whenTerminated, 10.seconds)
}
}
@ -203,15 +203,13 @@ class ActorsLeakSpec extends AkkaSpec(ActorsLeakSpec.config) with ImplicitSender
// All system messages has been acked now on this side
// This will make sure that no SHUTDOWN message gets through
Await.ready(RARP(system).provider.transport.managementCommand(ForceDisassociate(remoteAddress)), 3.seconds)
Await.result(RARP(system).provider.transport.managementCommand(ForceDisassociate(remoteAddress)), 3.seconds)
} finally {
remoteSystem.terminate()
}
EventFilter.warning(pattern = "Association with remote system", occurrences = 1).intercept {
Await.ready(remoteSystem.whenTerminated, 10.seconds)
}
Await.result(remoteSystem.whenTerminated, 10.seconds)
EventFilter[TimeoutException](occurrences = 1).intercept {}