From ef5a5954724260c9e1227f2ce1aba9e7e69cf055 Mon Sep 17 00:00:00 2001 From: Ethan Atkins Date: Sat, 8 Jun 2019 10:16:00 -0700 Subject: [PATCH] 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. --- .../scala-instance-classloader/src/test/scala/Test.scala | 4 +++- 1 file changed, 3 insertions(+), 1 deletion(-) diff --git a/sbt/src/sbt-test/tests/scala-instance-classloader/src/test/scala/Test.scala b/sbt/src/sbt-test/tests/scala-instance-classloader/src/test/scala/Test.scala index 7fdff3651..666c041b5 100644 --- a/sbt/src/sbt-test/tests/scala-instance-classloader/src/test/scala/Test.scala +++ b/sbt/src/sbt-test/tests/scala-instance-classloader/src/test/scala/Test.scala @@ -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) }