Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Allow secondary location for intercepts. #818

Open
wants to merge 14 commits into
base: master
Choose a base branch
from
1 change: 0 additions & 1 deletion riak

This file was deleted.

2 changes: 1 addition & 1 deletion src/rt_config.erl
Original file line number Diff line number Diff line change
Expand Up @@ -51,7 +51,7 @@ get_os_env(Var, Default) ->

%% @doc Load the configuration from the specified config file.
load(Config, undefined) ->
load(Config, filename:join([os:getenv("HOME"), ".riak_test.config"]));
load(Config, filename:join([os:getenv("PWD"), ".riak_test.config"]));
Copy link
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

I understand the motivation, but shouldn't this be additive? Check pwd first, if it's not there, check HOME?

Copy link
Contributor Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

This change shouldn't have made it in; this is a Lasp-specific change.

load(undefined, ConfigFile) ->
load_dot_config("default", ConfigFile);
load(ConfigName, ConfigFile) ->
Expand Down
13 changes: 7 additions & 6 deletions src/rt_intercept.erl
Original file line number Diff line number Diff line change
Expand Up @@ -25,19 +25,20 @@
files_to_mods(Files) ->
[list_to_atom(filename:basename(F, ".erl")) || F <- Files].

default_intercept_path_glob() ->
filename:join([rt_local:home_dir(), "intercepts", "*.erl"]).
default_intercept_path_globs() ->
Globs = rt_config:get(intercept_globs, []),
[filename:join([rt_local:home_dir(), "intercepts", "*.erl"])] ++ Globs.

intercept_files() ->
intercept_files([default_intercept_path_glob()]).
intercept_files(default_intercept_path_globs()).

intercept_files(Globs) ->
lists:concat([filelib:wildcard(Glob) || Glob <- Globs]).

%% @doc Load the intercepts on the nodes under test.
-spec load_intercepts([node()]) -> ok.
load_intercepts(Nodes) ->
load_intercepts(Nodes, [default_intercept_path_glob()]).
load_intercepts(Nodes, default_intercept_path_globs()).

-spec load_intercepts([node()], [string()]) -> ok.
load_intercepts(Nodes, Globs) ->
Expand All @@ -52,7 +53,7 @@ load_intercepts(Nodes, Globs) ->
end.

load_code(Node) ->
load_code(Node, [default_intercept_path_glob()]).
load_code(Node, default_intercept_path_globs()).

load_code(Node, Globs) ->
rt:wait_until_pingable(Node),
Expand Down Expand Up @@ -122,7 +123,7 @@ wait_until_loaded(Node, Tries) ->
end.

are_intercepts_loaded(Node) ->
are_intercepts_loaded(Node, [default_intercept_path_glob()]).
are_intercepts_loaded(Node, default_intercept_path_globs()).

are_intercepts_loaded(Node, Globs) ->
Results = [rpc:call(Node, code, is_loaded, [Mod])
Expand Down
2 changes: 1 addition & 1 deletion src/observer.erl → src/rt_observer.erl
Original file line number Diff line number Diff line change
@@ -1,4 +1,4 @@
-module(observer).
-module(rt_observer).
-compile(export_all).

-record(history, {network,
Expand Down
2 changes: 1 addition & 1 deletion src/rtperf.erl
Original file line number Diff line number Diff line change
Expand Up @@ -108,7 +108,7 @@ start_data_collectors(Nodes) ->
PrepDir = "/tmp/perf-"++OSPid,
file:make_dir(PrepDir),
{ok, Hostname} = inet:gethostname(),
P = observer:watch(Nodes, {Hostname, 65001, PrepDir}),
P = rt_observer:watch(Nodes, {Hostname, 65001, PrepDir}),
lager:info("started data collector: ~p", [P]),
P.

Expand Down
2 changes: 1 addition & 1 deletion tests/overload.erl → tests/overload_test.erl
Original file line number Diff line number Diff line change
Expand Up @@ -17,7 +17,7 @@
%% under the License.
%%
%% -------------------------------------------------------------------
-module(overload).
-module(overload_test).
-compile(export_all).
-include_lib("eunit/include/eunit.hrl").

Expand Down