For various reasons I want to have each ExUnit test to run in its own node. I reviewed the code for ExUnit in 1.2.6. and I have questions.
The work horse for actually executing a test seems to be
spawn_test/3 defined here:
Now, I think I could modify this to run in a slave node. Startup of the slave node will be handled like here: https://github.com/stavro/hello_master/blob/master/lib/hello_master/slave_node.ex
- Start slave
- Set code load paths to match that of master
- Retain hostname of slave
Node.spawnwith the slave hostname instead of
- Monitor the PID returned by
Node.spawn(there seems to be no
- Through the magic of
Node.spawnthe spawned process on the slave should send its response back to the process running on master (the PID is handed over in the closure of the lambda to execute)
- Leave timeout and other monitoring as is
- Add a stop of the slave after the
I guess I will have to copy the code of ExUnit in order to do this experiment.
Now, can anybody advise me if what I just described is feasible? Or did I overlook something vital?