whitfin / local-cluster

Easy local cluster creation for Elixir to aid in unit testing
MIT License
226 stars 30 forks source link

Allow user to override the Application environment #17

Closed veedo closed 4 years ago

veedo commented 4 years ago

In order to pass a different environment into the remote node when starting it, the user must change their local Application env, start the node, then change it back. For simple cases this works fine, but once tests are running in parallel, this can cause chaos.

This PR adds an :env_override option that allows the user to inject different environmental variables into the remote node. This is especially useful when each group of nodes in a test must start up on a different port or with different app options enabled.

Build passed: https://travis-ci.org/github/whitfin/local-cluster/builds/667949124

whitfin commented 4 years ago

I'm not sure I understand the use case; why would your test environment have different options to the environment you're running your tests under? What's the use case that you can't just change them in your local env?

whitfin commented 4 years ago

Regardless, I merged your changes inside https://github.com/whitfin/local-cluster/commit/523545b0bdc7cb077e8afb080d01ed35d4e53a8e - with a tweaking of the naming to environment and a slight touch of reformatting. Thanks for the contribution!

veedo commented 4 years ago

Thanks

Some examples that I'm using this for: