I ran into a similar issue while running tests in a similar environment.
What I think is happening is that the slave node is being started, but none of the modules from your master are loaded onto the code server for the slave. Here’s the blog post I read (in two parts) where I uncovered and figured out the solution: https://medium.com/@stavro/intro-slave-nodes-and-remote-code-loading-d1168bff7b20
Basically you have to point the slave node to the path where the .beam files live, so it can load it into its code server. This is done using :code.add_paths/1
Here’s what I did that seems to have solved the issue:
defmodule MyAppTest do
use ExUnit.Case, async: true
test "distributed test" do
:net_kernel.start([:node1, :shortnames, 3000])
{:ok, slave} = start_slave
# rest of the test
end
defp start_slave do
{:ok, hostname} = :inet.gethostname()
{:ok, slave} = :slave.start(hostname, 'slave')
:rpc.block_call(slave, :code, :add_paths, [:code.get_path])
{:ok, slave}
end
end






















