-
Notifications
You must be signed in to change notification settings - Fork 72
The Riak Test Rebar Plugin
This rebar plugin introduces three commands to rebar the integration of riak_test.
The plugin is built to integrate with repos like riak
and riak_ee
. The following is an addition I made to riak_ee
's rebar.config to setup the plugin
{plugins, [rebar_riak_test_plugin]}.
{riak_test, [
{test_paths, ["riak_test/tests", "../riak_test/tests"]},
{test_output, "riak_test/ebin"}
]}.
The first line just enables the plugin. Since riak_test
is included as a dependency, this won't work unless you've already done a make deps
and make compile
, but if you haven't done that, then what are you testing?
test_paths
are all the paths on which riak_tests exist. The plugin will compile every module it finds in these paths into the test_output
folder. What you end up with is a folder containing nothing but the complete set of compiled test modules for testing.
All of the rt_* commands only operate on the parent project.
./rebar clean
deletes the compiled modules from test_output
.
➜ riak_ee git:(jnd-riak_test) ✗ ./rebar clean
==> cluster_info (clean)
...
==> riak_ee (clean)
Removing test_output dir riak_test/ebin
./rebar compile
compiles all source modules in test_paths
into the test_output
directory.
➜ riak_ee git:(jnd-riak_test) ✗ ./rebar compile
==> cluster_info (compile)
...
==> riak_ee (compile)
Compiled ../riak_test/tests/verify_leave.erl
Compiled ../riak_test/tests/verify_down.erl
Compiled ../riak_test/tests/verify_staged_clustering.erl
Compiled ../riak_test/tests/verify_build_cluster.erl
Compiled ../riak_test/tests/verify_claimant.erl
Compiled ../riak_test/tests/verify_capabilities.erl
Compiled ../riak_test/tests/verify_basic_upgrade.erl
Compiled ../riak_test/tests/rt_basic_test.erl
Compiled ../riak_test/tests/upgrade.erl
Compiled ../riak_test/tests/mapred_verify_rt.erl
Compiled ../riak_test/tests/rolling_capabilities.erl
Compiled ../riak_test/tests/gh_riak_core_176.erl
Compiled ../riak_test/tests/gh_riak_core_155.erl
Compiled ../riak_test/tests/partition_repair.erl
Compiled ../riak_test/tests/loaded_upgrade.erl
Compiled ../riak_test/tests/gh_riak_core_154.erl
riak_test/tests/sample_ee_test.erl:3: Warning: function sample_ee_test/0 already exported
Compiled riak_test/tests/sample_ee_test.erl
➜ riak_ee git:(jnd-riak_test) ✗ ls riak_test/ebin
total 304
drwxr-xr-x 19 joe staff 646 Aug 20 08:20 .
drwxr-xr-x 4 joe staff 136 Aug 17 12:46 ..
-rw-r--r-- 1 joe staff 3516 Aug 20 08:20 gh_riak_core_154.beam
-rw-r--r-- 1 joe staff 5284 Aug 20 08:20 gh_riak_core_155.beam
-rw-r--r-- 1 joe staff 6084 Aug 20 08:20 gh_riak_core_176.beam
-rw-r--r-- 1 joe staff 22088 Aug 20 08:20 loaded_upgrade.beam
-rw-r--r-- 1 joe staff 2516 Aug 20 08:20 mapred_verify_rt.beam
-rw-r--r-- 1 joe staff 22304 Aug 20 08:20 partition_repair.beam
-rw-r--r-- 1 joe staff 3760 Aug 20 08:20 rolling_capabilities.beam
-rw-r--r-- 1 joe staff 1340 Aug 20 08:20 rt_basic_test.beam
-rw-r--r-- 1 joe staff 1640 Aug 20 08:20 sample_ee_test.beam
-rw-r--r-- 1 joe staff 2668 Aug 20 08:20 upgrade.beam
-rw-r--r-- 1 joe staff 4932 Aug 20 08:20 verify_basic_upgrade.beam
-rw-r--r-- 1 joe staff 3780 Aug 20 08:20 verify_build_cluster.beam
-rw-r--r-- 1 joe staff 10236 Aug 20 08:20 verify_capabilities.beam
-rw-r--r-- 1 joe staff 6376 Aug 20 08:20 verify_claimant.beam
-rw-r--r-- 1 joe staff 6548 Aug 20 08:20 verify_down.beam
-rw-r--r-- 1 joe staff 4512 Aug 20 08:20 verify_leave.beam
-rw-r--r-- 1 joe staff 13012 Aug 20 08:20 verify_staged_clustering.beam
./rebar rt_run config=rtdev test=verify_build_cluster
runs the test specified by test
with the configuration specified by config
. It is a glorified pass-through for the riak_test escript, minus the glory.
➜ riak_ee git:(jnd-riak_test) ✗ ./rebar rt_run config=rtdev test=verify_build_cluster
==> cluster_info (rt_run)
...
==> riak_ee (rt_run)
08:10:43.974 [debug] Lager installed handler lager_console_backend into lager_event
08:10:43.991 [debug] Lager installed handler error_logger_lager_h into error_logger
08:10:43.991 [info] Application lager started on node '[email protected]'
08:10:43.997 [info] Deploying 3 nodes
08:10:43.997 [info] Riak path: "/tmp/rt"
08:10:43.998 [info] Running: /tmp/rt/dev/dev1/bin/riak stop
08:10:43.998 [info] Running: /tmp/rt/dev/dev2/bin/riak stop
08:10:43.998 [info] Running: /tmp/rt/dev/dev3/bin/riak stop
08:10:46.546 [debug] Supervisor inet_gethost_native_sup started undefined at pid <0.141.0>
08:10:46.547 [debug] Supervisor kernel_safe_sup started inet_gethost_native:start_link() at pid <0.140.0>
08:10:46.570 [info] Resetting nodes to fresh state
08:10:46.570 [debug] Running: git --git-dir="/tmp/rt/.git" --work-tree="/tmp/rt/" reset HEAD --hard
08:10:47.160 [debug] Running: git --git-dir="/tmp/rt/.git" --work-tree="/tmp/rt/" clean -fd
08:10:47.246 [info] Running: /tmp/rt/dev/dev1/bin/riak start
08:10:47.246 [info] Running: /tmp/rt/dev/dev2/bin/riak start
08:10:47.246 [info] Running: /tmp/rt/dev/dev3/bin/riak start
08:10:52.754 [info] Deployed nodes: ['[email protected]','[email protected]','[email protected]']
08:10:52.754 [info] Ensure each nodes 100% of it's own ring
08:10:52.756 [info] Join nodes together
08:10:52.785 [debug] [join] '[email protected]' to ('[email protected]'): ok
08:10:52.835 [debug] [join] '[email protected]' to ('[email protected]'): ok
08:10:52.835 [info] Wait until all nodes are ready and there are no pending changes
08:11:01.429 [info] Ensure each node owns a portion of the ring
08:11:01.434 [info] verify_build_cluster: PASS
Once this PR is merged, and we integrate this plugin into riak_ee
, we'll be able to move EDS specific tests into the riak_ee
repo in preparation to open source riak_test