riak_test/intercepts/riak_pipe_vnode_intercepts.erl
Bryan Fink 4775f257e6 use an intercept instead of riak_core_tracer in pipe handoff test
riak_core_tracer was not providing accurate operation counts, but
riak_pipe_vnode_intercept seems to
2013-01-11 12:26:55 -05:00

26 lines
789 B
Erlang

-module(riak_pipe_vnode_intercepts).
-compile(export_all).
-include("intercept.hrl").
-define(M, riak_pipe_vnode_orig).
%%% Intercepts
%% @doc Log every command received by the vnode during handoff, so a
%% test can analyze them later. Sends the first element of the `Cmd'
%% tuple (the command type) to the process registered as
%% `riak_test_collector'.
%%
%% Tests using this intercept are expected to start the collector
%% process themselves.
log_handoff_command(Cmd, Sender, State) ->
try
riak_test_collector ! element(1, Cmd)
catch error:badarg when not is_tuple(Cmd) ->
?I_INFO("Cmd was not a tuple");
error:badarg ->
?I_INFO("Collector process not registered")
end,
?M:handle_handoff_command_orig(Cmd, Sender, State).