Logo Questions Linux Laravel Mysql Ubuntu Git Menu
 

Setting akka TestKit default timeout in code

Tags:

scala

akka

What's the correct way to set a default timeout for TestProbe.expectNoMsg() in code not in config?

I'm aware that I can define akka.test.single-expect-default in application.conf, but this applies to all tests in my module. Or something like

ActorSystem(.., ConfigFactory.parseString("{akka.test.single-expect-default = 0}"))

in code works, but I'd expect to be able to set this timeout like

implicit val timeout = Timeout(100 millis)

which I've seen references to but is not being recognized.

My test is

@RunWith(classOf[JUnitRunner])
class MySuite extends path.FunSpec with Matchers {

    implicit val system = ActorSystem("MySuite")

    val probe = new TestProbe(system)

    describe ("timeout") {
        println("Waiting..")
        probe.expectNoMsg()
        println("Waited")
    }
}
like image 298
tariksbl Avatar asked May 06 '14 15:05

tariksbl


1 Answers

you want to set

akka.test.single-expect-default

in your config

like image 100
fommil Avatar answered Oct 25 '22 17:10

fommil