How to change akka remote configuration with GuiceApplicationBuilder in Play?

278 Views Asked by At

I don't manage to change the configuration of akka remote in the tests of my Play! scala application.

In my application.conf file, I set the akka remote port like this, and it works well:

akka.remote.netty.tcp.port = 2552

In my integration tests, I run a fakeApplication, and I override the configuration like this:

  lazy val fakeApplication = new GuiceApplicationBuilder().configure(Map(
  "slick.dbs.default.driver" -> "slick.driver.PostgresDriver$",
  "slick.dbs.default.db.driver" -> "org.postgresql.Driver",
  "slick.dbs.default.db.url" -> "jdbc:postgresql://dbHostTest:5432/tests",
  "slick.dbs.default.db.user" -> "user",
  "slick.dbs.default.db.password" -> "pwd",
  "slick.dbs.default.db.connectionTimeout" -> "5 seconds",
  "slick.dbs.default.db.connectionPool" -> "disabled",
  "akka.remote.netty.tcp.port" -> 0))
.build()

The database configuration is well taken into account (I'm sure).
But the last line ("akka.remote.netty.tcp.port" -> 0) is not taken into account, and I get a BindException because the address is already in use. (If I change it directly in my application.conf file, everything works well, but I want to be able to choose the port and not set the port 0.)

What can I do in order to change this config in my tests?

0

There are 0 best solutions below