Wait for akka termination in test

We now correctly close the test classloader which can cause this
scripted test to fail if the classloader is closed before the actor
system finishes terminating.
This commit is contained in:
Ethan Atkins 2019-06-08 10:16:00 -07:00
parent fd0f078c73
commit ef5a595472
1 changed files with 3 additions and 1 deletions

View File

@ -1,6 +1,8 @@
package akka.actor
import org.junit._
import scala.concurrent._
import scala.concurrent.duration._
class BadTest {
@ -13,7 +15,7 @@ class BadTest {
val system = ActorSystem()
def evilGetThreadExectionContextName =
system.asInstanceOf[ActorSystemImpl].internalCallingThreadExecutionContext.getClass.getName
system.terminate()
Await.result(system.terminate(), 5.seconds)
val expected = "scala.concurrent.Future$InternalCallbackExecutor$"
Assert.assertEquals("Failed to grab appropriate Akka name", expected, evilGetThreadExectionContextName)
}