whitfin / local-cluster

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

Support arbitrary manager node name #25

Closed karolsluszniak closed 10 months ago

karolsluszniak commented 2 years ago

This PR allows the LocalCluster library to work with any node name instead of the hardcoded manager@127.0.0.1. This may be useful if other parts of the test suite require a specific basename or externally reachable hostname. In my case, the requirement was for the test runner node to be reachable from Docker nodes that are needed for integration testing (these nodes run a completely different pre-built Elixir project so LocalCluster is still needed for testing clustering of the current project).

This is not a breaking change in any way since manager@127.0.0.1 is still the default and the dynamic host lookup (that allows this lib to work properly even if :net_kernel.start is invoked before & outside of LocalCluster.start) will yield the same value as the previously hardcoded one.

I've provided a test case that requires a custom host in /etc/hosts but the test case nicely explains it all and it reverts to the original default setup.

whitfin commented 10 months ago

This was closed accidentally when changing the main branch, feel free to reopen against main (I can't seem to).