[erlang-questions] [ANN] detest: Tool for running tests on a cluster of erlang nodes
Wed Feb 11 16:23:25 CET 2015
Criticisms and suggestions welcome:
Detest is a tool for running distributed erlang tests. It is designed to be simple and flexible. It sets up a distributed environment of multiple nodes, then it calls your code to do whatever you wish with that environment.
As a parameter it takes in path to your test script. This script needs to export at least: cfg/1, run/1, setup/1, cleanup/1.
Detest is configured with your cfg/1 function within the script. It instructs detest how many nodes to run, where their configuration files are, how to execute your app, etc.
Detest will then execute the nodes, connect to each (as a hidden node) wait for your app to start, then call run/1 function in your script. You are then free to do whatever you wish. RPC is possible to any of the nodes. You can also terminate the test at any time by entering q to terminal.
Run it like so:
You can print all console output from your nodes:
./detest -v test/test.erl
You can also send arguments to your script:
./detest -v test/test.erl dotest1
If you are on linux and willing to run detest as sudo, it will use damocles library to create seperate network interfaces for every node that you have configured. You can then call damocles library directly and create various network condition like packetloss, delays or network splits between nodes.
detest will create a folder named .detest in at location it is running from. This is where node logs and state should go.
For an example look at: test/test.erl and test/app.config
More information about the erlang-questions