tariksbl
tariksbl

Reputation: 1089

Setting akka TestKit default timeout in code

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")
    }
}

Upvotes: 9

Views: 2433

Answers (1)

fommil
fommil

Reputation: 5875

you want to set

akka.test.single-expect-default

in your config

Upvotes: 3

Related Questions