Skip to content
This repository has been archived by the owner on May 2, 2023. It is now read-only.

Commit

Permalink
add default shell nodename and cookie, fix broken test suites
Browse files Browse the repository at this point in the history
  • Loading branch information
goncalotomas committed Oct 22, 2018
1 parent b671c6c commit 1312792
Show file tree
Hide file tree
Showing 6 changed files with 27 additions and 6 deletions.
5 changes: 5 additions & 0 deletions rebar.config
Original file line number Diff line number Diff line change
Expand Up @@ -74,3 +74,8 @@
{xref_checks, [
deprecated_function_calls, deprecated_functions, undefined_function_calls, undefined_functions
]}.

{dist_node, [
{name, 'fmke@127.0.0.1'},
{setcookie, fmke}
]}.
Original file line number Diff line number Diff line change
Expand Up @@ -25,8 +25,9 @@ suite() ->
%% Reason = term()
%%--------------------------------------------------------------------
init_per_suite(Config) ->
{ok, _} = net_kernel:start(['fmke_antidote_ct@127.0.0.1']),
true = erlang:set_cookie('fmke_antidote_ct@127.0.0.1', ?COOKIE),
TestNode = 'fmke_antidote_ct@127.0.0.1',
ok = fmke_test_setup:ensure_start_dist_node(TestNode),
true = erlang:set_cookie(TestNode, ?COOKIE),
fmke_test_setup:start_node_with_antidote_backend(?NODENAME, true, non_nested),
true = erlang:set_cookie(?NODENAME, ?COOKIE),
Config.
Expand Down
2 changes: 1 addition & 1 deletion test/fmke_core_unit_test_SUITE.erl
Original file line number Diff line number Diff line change
Expand Up @@ -63,7 +63,7 @@ init_per_suite(Config) ->
OptionValues = lists:map(fun(Opt) ->
{Opt, ct:get_config(Opt, ?DEFAULT(Opt))}
end, ?OPTIONS),
{ok, _} = net_kernel:start([CTNodename]),
ok = fmke_test_setup:ensure_start_dist_node(CTNodename),
true = erlang:set_cookie(CTNodename, ?COOKIE),
Node = fmke_test_setup:launch_app(FMKeNodename, OptionValues),
[{node, Node} | Config].
Expand Down
5 changes: 3 additions & 2 deletions test/fmke_db_conn_manager_SUITE.erl
Original file line number Diff line number Diff line change
Expand Up @@ -25,8 +25,9 @@ suite() ->
%% Reason = term()
%%--------------------------------------------------------------------
init_per_suite(Config) ->
{ok, _} = net_kernel:start(['fmke_db_conn_mgr_test@127.0.0.1']),
true = erlang:set_cookie('fmke_db_conn_mgr_test@127.0.0.1', ?COOKIE),
TestNode = 'fmke_db_conn_mgr_test@127.0.0.1',
ok = fmke_test_setup:ensure_start_dist_node(TestNode),
true = erlang:set_cookie(TestNode, ?COOKIE),
fmke_test_setup:start_node_with_mock_cluster(?NODENAME, true, non_nested),
true = erlang:set_cookie(?NODENAME, ?COOKIE),
Config.
Expand Down
2 changes: 1 addition & 1 deletion test/fmke_http_api_SUITE.erl
Original file line number Diff line number Diff line change
Expand Up @@ -58,7 +58,7 @@ init_per_suite(Config) ->
OptionValues = lists:map(fun(Opt) ->
{Opt, ct:get_config(Opt, ?DEFAULT(Opt))}
end, ?OPTIONS),
{ok, _} = net_kernel:start([CTNodename]),
ok = fmke_test_setup:ensure_start_dist_node(CTNodename),
true = erlang:set_cookie(CTNodename, ?COOKIE),
Node = fmke_test_setup:launch_app(FMKeNodename, OptionValues),
[{node, Node} | Config].
Expand Down
14 changes: 14 additions & 0 deletions test/fmke_test_setup.erl
Original file line number Diff line number Diff line change
Expand Up @@ -13,6 +13,7 @@
start_node_with_riak_backend/3,
start_node_with_mock_cluster/3,
launch_app/2,
ensure_start_dist_node/1,
stop_all/0,
stop_antidote/0,
stop_riak/0,
Expand Down Expand Up @@ -160,6 +161,19 @@ launch_app(Nodename, Config) ->
ok = start_db(Database, Port),
start_node(Nodename, Config).

ensure_start_dist_node(Nodename) ->
case node() of
'nonode@nohost' ->
{ok, _} = net_kernel:start([Nodename]),
ok;
Nodename ->
ok;
_Else ->
ok = net_kernel:stop(),
{ok, _} = net_kernel:start([Nodename]),
ok
end.

start_db(antidote, Port) ->
start_antidote(Port);
start_db(ets, _Port) ->
Expand Down

0 comments on commit 1312792

Please sign in to comment.