Simplest application.conf for test

(Brett Tofel) #1

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
(Scot Mcphee) #2

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?

(Brett Tofel) #3

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.

(Scot Mcphee) #4

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