In MultiNodeSpec.scala#L120, transportConfig is used as fallback only.
In my tests, nodeConfig is loaded using ConfigFactory.load() hence it gets the default values from akka-remote’s reference.conf, effectively discard transportConfig completely.
I can add withoutPath for the nodeConfig, but that requires me to check and update (if required) whenever I upgrade akka version.
What is the best approach for this?
nodeConfig
is essentially meant for overriding node specific config, not for loading an entire config with reference.conf
defaults etc. One use case would for example be to set different roles on the nodes in a test, or grouping nodes into separate datacenters.
In general you are not expected to want to load the default set of config files for a multi-jvm test, if you want to extract test environment settings, database config for example, you can do that with a separate test config named whatever you want and then load that into commonConfig
using ConfigFactory.parseFile
rather than load()
.
If you are completely sure you want a special setup, you could instead use another MultiNodeSpec
constructor directly, there is one that takes a Config => ActorSystem
that will allow you specify what logic is applied to the config so you can sandwich the configs any way you want before creating the ActorSystem
. I’d recommend not thinking of this as your first option though.
Thank you @johanandren for your suggestions. Let me review my config setup again.