Initial work on standardizing test results

This commit is contained in:
Joe DeVivo 2012-08-23 12:19:21 -07:00
parent 6f40557746
commit af9e6aad8c
3 changed files with 20 additions and 9 deletions

View File

@ -25,21 +25,19 @@ main(Args) ->
application:set_env(lager, handlers, [{lager_console_backend, LagerLevel}]),
lager:start(),
%% add handler for specific test.
gen_event:add_handler(lager_event, riak_test_lager_backend, [LagerLevel, false]),
%% rt:set_config(rtdev_path, Path),
%% rt:set_config(rt_max_wait_time, 180000),
%% rt:set_config(rt_retry_delay, 500),
%% rt:set_config(rt_harness, rtbe),
rt:setup_harness(Test, HarnessArgs),
TestA = list_to_atom(Test),
%% st:TestFn(),
TestA:TestA(),
SingleTestResult = riak_test_runner:run(TestA),
io:format("STR: ~p~n", [SingleTestResult]),
rt:cleanup_harness(),
%% Custom Logging Voodoo
{ok, Logs} = gen_event:delete_handler(lager_event, riak_test_lager_backend, []),
io:format("Test Status: ~s~n", [proplists:get_value(status, SingleTestResult)]),
Logs = proplists:get_value(log, SingleTestResult),
io:format("Handled Log: ~n"),
[ io:put_chars(user, [Log, "\n"]) || Log <- Logs ],

13
src/riak_test_runner.erl Normal file
View File

@ -0,0 +1,13 @@
-module(riak_test_runner).
-export([run/1]).
run(TestModule) ->
LagerLevel = rt:config(rt_lager_level, debug),
gen_event:add_handler(lager_event, riak_test_lager_backend, [LagerLevel, false]),
Result = TestModule:run(),
{ok, Log} = gen_event:delete_handler(lager_event, riak_test_lager_backend, []),
[{status, Result}, {log, Log}].

View File

@ -8,7 +8,7 @@
wait_until_nodes_ready/1,
wait_until_no_pending_changes/1]).
verify_build_cluster() ->
run() ->
%% Deploy a set of new nodes
lager:info("Deploying 3 nodes"),
Nodes = rt:deploy_nodes(3),
@ -30,4 +30,4 @@ verify_build_cluster() ->
lager:info("Ensure each node owns a portion of the ring"),
[?assertEqual(Nodes, owners_according_to(Node)) || Node <- Nodes],
lager:info("verify_build_cluster: PASS"),
ok.
pass.