Simplest application.conf for test

Hi,
I thought this should work, but I’m still seeing my src/main/resources/application.conf load, including clustering and remoting, all of which I do not want for tests:

I put a file /src/test/resources/application.conf with just akka {} (I also tried a variant that had akka {actor {}} and some logging defined. But in all cases, the remoting and other info from my main/resources/application.conf was used.

How can I achieve overriding of the clustering and remoting that happens in my src application.conf for tests? I really can’t tell from the Akka testing documentation I’ve found available.

Thanks,
Brett

1 Like

This is something I’ve been wondering about as well. For the moment, I’ve just got my test/resources/application.conf because I’m still writing and testing my basic design, but I’ve been unable to isolate it from the main configuration, and will need to in the near future. Did you discover a way to do this?

I have not found a way and I hope someone knows how to do this. Currently I don’t know how to achieve isolation so that I can have an entirely simple and unit testable actor system for test.

In my case I particularly can’t allow the production conf with remoting to. come up at test time, it’s bad for all sorts of reasons.

Yeah, I agree. In production we will have a cluster, with sharding, discovery, and a persistence store, and all sorts of attached services, which in test, we do not want. E.g. persistence store in-memory, a cluster of one instance, and so on.

It’s not clear to me (yet) how to isolate the unit tests from reading the src/main/resources/application.conf

src/test/resources/application-test.conf
should be picked up according to akka docs.

my problem is how to bypass sharding code in test, create slimmed-down local tree of Actors