Skip to content

Commit

Permalink
fixed slave node code_path failed
Browse files Browse the repository at this point in the history
  • Loading branch information
zhongwencool committed Jan 15, 2020
1 parent 6e8cdfa commit 8b21a20
Showing 1 changed file with 19 additions and 18 deletions.
37 changes: 19 additions & 18 deletions test/prop_ecron_global_SUITE.erl
Original file line number Diff line number Diff line change
Expand Up @@ -37,50 +37,50 @@ basic(_Config) ->
start_master(2),
undefined = global:whereis_name(ecron),
start_slave(?Slave1, 2),
timer:sleep(180),
timer:sleep(300),
Pid = global:whereis_name(ecron),
true = is_pid(Pid),
timer:sleep(180),
timer:sleep(300),
Pid1 = rpc:call(?Slave1, global, whereis_name, [ecron]),
true = is_pid(Pid1),
start_slave(?Slave2, 2),
timer:sleep(180),
timer:sleep(300),
Pid2 = rpc:call(?Slave2, global, whereis_name, [ecron]),
true = is_pid(Pid2),
stop_slave(?Slave1),
timer:sleep(180),
timer:sleep(300),
Pid3 = global:whereis_name(ecron),
true = is_pid(Pid3),
stop_slave(?Slave2),
timer:sleep(180),
timer:sleep(300),
undefined = global:whereis_name(ecron),
stop_master(),
undefined = global:whereis_name(ecron),
ok.

quorum(_Config) ->
start_master(1),
timer:sleep(150),
timer:sleep(300),
Pid0 = global:whereis_name(ecron),
error = gen_server:call(ecron_monitor, test),
gen_server:cast(ecron_monitor, test),
true = is_pid(Pid0),
start_slave(?Slave1, 1),
Pid = global:whereis_name(ecron),
true = is_pid(Pid),
timer:sleep(180),
timer:sleep(300),
Pid1 = rpc:call(?Slave1, global, whereis_name, [ecron]),
true = is_pid(Pid1),
start_slave(?Slave2, 1),
timer:sleep(180),
timer:sleep(300),
Pid2 = rpc:call(?Slave2, global, whereis_name, [ecron]),
true = is_pid(Pid2),
stop_slave(?Slave1),
timer:sleep(180),
timer:sleep(300),
Pid3 = global:whereis_name(ecron),
true = is_pid(Pid3),
stop_slave(?Slave2),
timer:sleep(180),
timer:sleep(300),
Pid4 = global:whereis_name(ecron),
true = is_pid(Pid4),
stop_master(),
Expand All @@ -89,24 +89,24 @@ quorum(_Config) ->

quorum_in_majority(_Config) ->
start_master(2),
timer:sleep(150),
timer:sleep(300),
undefined = global:whereis_name(ecron),
start_slave(?Slave1, 2),
timer:sleep(150),
timer:sleep(300),
Pid = global:whereis_name(ecron),
true = is_pid(Pid),
Pid1 = rpc:call(?Slave1, global, whereis_name, [ecron]),
true = is_pid(Pid1),
start_slave(?Slave2, 2),
timer:sleep(180),
timer:sleep(300),
Pid2 = rpc:call(?Slave2, global, whereis_name, [ecron]),
true = is_pid(Pid2),
rpc:call(?Slave1, application, stop, [ecron]),
timer:sleep(180),
timer:sleep(300),
Pid3 = global:whereis_name(ecron),
true = is_pid(Pid3),
rpc:call(?Slave2, application, stop, [ecron]),
timer:sleep(180),
timer:sleep(300),
undefined = global:whereis_name(ecron),
stop_slave(?Slave1),
stop_slave(?Slave2),
Expand All @@ -118,7 +118,7 @@ transfer(_Config) ->
start_slave(?Slave1, 1),
start_slave(?Slave2, 1),
stop_master(),
timer:sleep(180),
timer:sleep(300),
Pid1 = global:whereis_name(ecron),
true = is_pid(Pid1),
start_master(1),
Expand Down Expand Up @@ -183,8 +183,9 @@ start_slave(Node, Quorum) ->
SlaveStr = atom_to_list(Node),
[NameStr, _IpStr] = string:tokens(SlaveStr, [$@]),
Name = list_to_atom(NameStr),
{ok, _N} = test_server:start_node(Name, slave, [{start_cover, true}]),
ok = rpc:call(Node, code, add_pathsz, [code:get_path()]),
Args = lists:flatten("-pa " ++ lists:join(" ", code:get_path())),
{ok, _N} = test_server:start_node(Name, slave, [{start_cover, true}, {args, Args}]),
%% ok = rpc:call(Node, code, add_pathsz, [code:get_path()]),
ok = rpc:call(Node, ?MODULE, set_app_env, [?Env(Quorum)]),
{ok, _SlaveApps} = rpc:call(Node, application, ensure_all_started, [ecron]),
ok.
Expand Down

0 comments on commit 8b21a20

Please sign in to comment.