Move log_to_nodes into rt module for general use.

This commit is contained in:
Chris Tilt 2013-01-24 15:51:33 -08:00
parent a076531785
commit b0ca6fa2c5
3 changed files with 24 additions and 19 deletions

View File

@ -72,6 +72,8 @@
leave/1,
load_config/1,
load_modules_on_nodes/2,
log_to_nodes/2,
log_to_nodes/3,
members_according_to/1,
owners_according_to/1,
partition/2,
@ -1013,6 +1015,25 @@ get_version() ->
whats_up() ->
?HARNESS:whats_up().
%% @doc Log a message to the console of the specified test nodes.
%% Messages are prefixed by the string "---riak_test--- "
%% Uses lager:info/1 'Fmt' semantics
log_to_nodes(Nodes, Fmt) ->
log_to_nodes(Nodes, Fmt, []).
%% @doc Log a message to the console of the specified test nodes.
%% Messages are prefixed by the string "---riak_test--- "
%% Uses lager:info/2 'LFmt' and 'LArgs' semantics
log_to_nodes(Nodes, LFmt, LArgs) ->
Module = lager,
Function = log,
Meta = [],
Args = case LArgs of
[] -> [info, Meta, "---riak_test--- " ++ LFmt];
_ -> [info, Meta, "---riak_test--- " ++ LFmt, LArgs]
end,
[rpc:call(Node, Module, Function, Args) || Node <- Nodes].
%% @private utility function
pmap(F, L) ->
Parent = self(),

View File

@ -1,7 +1,5 @@
-module(repl_util).
-export([make_cluster/1,
log_to_nodes/2,
log_to_nodes/3]).
-export([make_cluster/1]).
-compile(export_all).
-include_lib("eunit/include/eunit.hrl").
@ -15,16 +13,3 @@ make_cluster(Nodes) ->
[join(Node, First) || Node <- Rest],
?assertEqual(ok, wait_until_nodes_ready(Nodes)),
?assertEqual(ok, wait_until_no_pending_changes(Nodes)).
log_to_nodes(Nodes, Fmt) ->
log_to_nodes(Nodes, Fmt, []).
log_to_nodes(Nodes, LFmt, LArgs) ->
Module = lager,
Function = log,
Meta = [],
Args = case LArgs of
[] -> [info, Meta, "---riak_test--- " ++ LFmt];
_ -> [info, Meta, "---riak_test--- " ++ LFmt, LArgs]
end,
[rpc:call(Node, Module, Function, Args) || Node <- Nodes].

View File

@ -6,12 +6,11 @@
-import(rt, [deploy_nodes/2,
join/2,
log_to_nodes/2,
log_to_nodes/3,
wait_until_nodes_ready/1,
wait_until_no_pending_changes/1]).
-import(repl_util, [log_to_nodes/2,
log_to_nodes/3]).
confirm() ->
NumNodes = rt:config(num_nodes, 6),
ClusterASize = rt:config(cluster_a_size, 3),