Modifying ExUnit to run with slave nodes?



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:

So, basically:

  • Start slave
  • Set code load paths to match that of master
  • Retain hostname of slave
  • Call Node.spawn with the slave hostname instead of spawn_monitor
  • Monitor the PID returned by Node.spawn (there seems to be no Node.spawn_monitor atomic function)
  • Through the magic of Node.spawn the 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 Process.exit and Process.demonitor calls.

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?

ExUnit testing with registry?