Un-TEST'ify testr_react_to_env() everywhere
This commit is contained in:
parent
78c81f93b7
commit
9b3cd9056a
7 changed files with 27 additions and 27 deletions
|
@ -93,7 +93,8 @@
|
|||
|
||||
%% API
|
||||
-export([start_link/2, start_link/3, stop/1, ping/1,
|
||||
set_chain_members/2, set_active/2]).
|
||||
set_chain_members/2, set_active/2,
|
||||
trigger_react_to_env/1]).
|
||||
-export([init/1, handle_call/3, handle_cast/2, handle_info/2,
|
||||
terminate/2, code_change/3]).
|
||||
|
||||
|
@ -105,7 +106,6 @@
|
|||
-export([test_calc_projection/2,
|
||||
test_write_public_projection/2,
|
||||
test_read_latest_public_projection/2,
|
||||
test_react_to_env/1,
|
||||
get_all_hosed/1]).
|
||||
|
||||
-ifdef(EQC).
|
||||
|
@ -146,6 +146,9 @@ set_chain_members(Pid, MembersDict) ->
|
|||
set_active(Pid, Boolean) when Boolean == true; Boolean == false ->
|
||||
gen_server:call(Pid, {set_active, Boolean}, infinity).
|
||||
|
||||
trigger_react_to_env(Pid) ->
|
||||
gen_server:call(Pid, {trigger_react_to_env}, infinity).
|
||||
|
||||
-ifdef(TEST).
|
||||
|
||||
%% Test/debugging code only.
|
||||
|
@ -163,9 +166,6 @@ test_read_latest_public_projection(Pid, ReadRepairP) ->
|
|||
gen_server:call(Pid, {test_read_latest_public_projection, ReadRepairP},
|
||||
infinity).
|
||||
|
||||
test_react_to_env(Pid) ->
|
||||
gen_server:call(Pid, {test_react_to_env}, infinity).
|
||||
|
||||
-endif. % TEST
|
||||
|
||||
%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%
|
||||
|
@ -284,7 +284,7 @@ handle_call({test_read_latest_public_projection, ReadRepairP}, _From, S) ->
|
|||
do_cl_read_latest_public_projection(ReadRepairP, S),
|
||||
Res = {Perhaps, Val, ExtraInfo},
|
||||
{reply, Res, S2};
|
||||
handle_call({test_react_to_env}=Call, _From, S) ->
|
||||
handle_call({trigger_react_to_env}=Call, _From, S) ->
|
||||
gobble_calls(Call),
|
||||
{TODOtodo, S2} = do_react_to_env(S),
|
||||
{reply, TODOtodo, S2};
|
||||
|
@ -2003,11 +2003,11 @@ make_chmgr_regname(A) when is_atom(A) ->
|
|||
make_chmgr_regname(B) when is_binary(B) ->
|
||||
list_to_atom(binary_to_list(B) ++ "_chmgr").
|
||||
|
||||
gobble_calls(_StaticCall) ->
|
||||
gobble_calls(StaticCall) ->
|
||||
receive
|
||||
{'$gen_call',From,{test_react_to_env}} ->
|
||||
{'$gen_call',From,{trigger_react_to_env}} ->
|
||||
gen_server:reply(From, todo_overload),
|
||||
gobble_calls(_StaticCall)
|
||||
gobble_calls(StaticCall)
|
||||
after 1 -> % after 0 angers pulse.
|
||||
ok
|
||||
end.
|
||||
|
|
|
@ -261,7 +261,7 @@ append_server_loop(FluPid, #state{data_dir=DataDir, wedged=Wedged_p,
|
|||
%% this new world.
|
||||
Chmgr = machi_chain_manager1:make_chmgr_regname(FluName),
|
||||
spawn(fun() ->
|
||||
catch machi_chain_manager1:test_react_to_env(Chmgr)
|
||||
catch machi_chain_manager1:trigger_react_to_env(Chmgr)
|
||||
end),
|
||||
append_server_loop(FluPid, S#state{wedged=true});
|
||||
true ->
|
||||
|
@ -468,7 +468,7 @@ do_server_proj_request({kick_projection_reaction},
|
|||
%% this new world.
|
||||
Chmgr = machi_chain_manager1:make_chmgr_regname(FluName),
|
||||
spawn(fun() ->
|
||||
catch machi_chain_manager1:test_react_to_env(Chmgr)
|
||||
catch machi_chain_manager1:trigger_react_to_env(Chmgr)
|
||||
end),
|
||||
async_no_response.
|
||||
|
||||
|
|
|
@ -2,7 +2,7 @@
|
|||
%%
|
||||
%% Machi: a small village of replicated files
|
||||
%%
|
||||
%% Copyright (c) 2014 Basho Technologies, Inc. All Rights Reserved.
|
||||
%% Copyright (c) 2014-2015 Basho Technologies, Inc. All Rights Reserved.
|
||||
%%
|
||||
%% This file is provided to you under the Apache License,
|
||||
%% Version 2.0 (the "License"); you may not use this file
|
||||
|
@ -207,7 +207,7 @@ convergence_demo_testfun(NumFLUs, MgrOpts0) ->
|
|||
?MGR:sleep_ranked_order(
|
||||
S_min, S_max_rand,
|
||||
M_name, All_list),
|
||||
_ = ?MGR:test_react_to_env(MMM),
|
||||
_ = ?MGR:trigger_react_to_env(MMM),
|
||||
%% Be more unfair by not
|
||||
%% sleeping here.
|
||||
% timer:sleep(S_max - Elapsed),
|
||||
|
|
|
@ -149,11 +149,11 @@ setup(Num, Seed) ->
|
|||
%% do all the same server first, then round-robin evenly across
|
||||
%% servers.
|
||||
[begin
|
||||
_QQa = machi_chain_manager1:test_react_to_env(get_chmgr(P))
|
||||
_QQa = machi_chain_manager1:trigger_react_to_env(get_chmgr(P))
|
||||
end || {P, _Dir} <- All_listE, _I <- lists:seq(1,20), _Repeat <- [1,2]],
|
||||
?QC_FMT(",z~w", [?LINE]),
|
||||
[begin
|
||||
_QQa = machi_chain_manager1:test_react_to_env(get_chmgr(P))
|
||||
_QQa = machi_chain_manager1:trigger_react_to_env(get_chmgr(P))
|
||||
end || _I <- lists:seq(1,20), {P, _Dir} <- All_listE, _Repeat <- [1,2]],
|
||||
?QC_FMT(",z~w", [?LINE]),
|
||||
|
||||
|
@ -402,7 +402,7 @@ exec_ticks(Num, All_listE) ->
|
|||
Max = 10,
|
||||
Elapsed =
|
||||
?MGR:sleep_ranked_order(1, Max, M_name, all_list()),
|
||||
Res = ?MGR:test_react_to_env(get_chmgr(P)),
|
||||
Res = ?MGR:trigger_react_to_env(get_chmgr(P)),
|
||||
timer:sleep(erlang:max(0, Max - Elapsed)),
|
||||
Res=Res %% ?D({self(), Res})
|
||||
end || _ <- lists:seq(1,Num)],
|
||||
|
|
|
@ -232,8 +232,8 @@ nonunanimous_setup_and_fix_test() ->
|
|||
%% we expect nothing to change when called again.
|
||||
{not_unanimous,_,_}=_YY = ?MGR:test_read_latest_public_projection(Ma, true),
|
||||
|
||||
{now_using, _, EpochNum_a} = ?MGR:test_react_to_env(Ma),
|
||||
{no_change, _, EpochNum_a} = ?MGR:test_react_to_env(Ma),
|
||||
{now_using, _, EpochNum_a} = ?MGR:trigger_react_to_env(Ma),
|
||||
{no_change, _, EpochNum_a} = ?MGR:trigger_react_to_env(Ma),
|
||||
{unanimous,P2,_E2} = ?MGR:test_read_latest_public_projection(Ma, false),
|
||||
{ok, P2pa} = ?FLU_PC:read_latest_projection(Proxy_a, private),
|
||||
P2 = P2pa#projection_v1{dbg2=[]},
|
||||
|
@ -244,7 +244,7 @@ nonunanimous_setup_and_fix_test() ->
|
|||
|
||||
%% %% Poke FLUb to react ... should be using the same private proj
|
||||
%% %% as FLUa.
|
||||
%% {now_using, _, EpochNum_a} = ?MGR:test_react_to_env(Mb),
|
||||
%% {now_using, _, EpochNum_a} = ?MGR:trigger_react_to_env(Mb),
|
||||
{ok, P2pb} = ?FLU_PC:read_latest_projection(Proxy_b, private),
|
||||
P2 = P2pb#projection_v1{dbg2=[]},
|
||||
|
||||
|
|
|
@ -51,9 +51,9 @@ smoke_test2() ->
|
|||
{ok, _} = machi_flu_psup:start_flu_package(Name, Port, Dir, [])
|
||||
end || {_,P} <- [hd(Ps)]],
|
||||
|
||||
[machi_chain_manager1:test_react_to_env(a_chmgr) || _ <-lists:seq(1,5)],
|
||||
[machi_chain_manager1:trigger_react_to_env(a_chmgr) || _ <-lists:seq(1,5)],
|
||||
machi_chain_manager1:set_chain_members(a_chmgr, orddict:from_list(Ps)),
|
||||
[machi_chain_manager1:test_react_to_env(a_chmgr) || _ <-lists:seq(1,5)],
|
||||
[machi_chain_manager1:trigger_react_to_env(a_chmgr) || _ <-lists:seq(1,5)],
|
||||
ok
|
||||
after
|
||||
exit(SupPid, normal),
|
||||
|
@ -101,16 +101,16 @@ partial_stop_restart2() ->
|
|||
[{ok,_} = Append(P, EpochID1) || P <- Ps], % *not* wedged
|
||||
{ok, {_,_,File1}} = Append(hd(Ps), EpochID1),
|
||||
|
||||
{_,_,_} = machi_chain_manager1:test_react_to_env(hd(ChMgrs)),
|
||||
{_,_,_} = machi_chain_manager1:trigger_react_to_env(hd(ChMgrs)),
|
||||
[begin
|
||||
_QQa = machi_chain_manager1:test_react_to_env(ChMgr)
|
||||
_QQa = machi_chain_manager1:trigger_react_to_env(ChMgr)
|
||||
end || _ <- lists:seq(1,125), ChMgr <- ChMgrs],
|
||||
|
||||
%% All chain managers & projection stores should be using the
|
||||
%% same projection which is max projection in each store.
|
||||
{no_change,_,Epoch_m} = machi_chain_manager1:test_react_to_env(
|
||||
{no_change,_,Epoch_m} = machi_chain_manager1:trigger_react_to_env(
|
||||
hd(ChMgrs)),
|
||||
[{no_change,_,Epoch_m} = machi_chain_manager1:test_react_to_env(
|
||||
[{no_change,_,Epoch_m} = machi_chain_manager1:trigger_react_to_env(
|
||||
ChMgr )|| ChMgr <- ChMgrs],
|
||||
{ok, Proj_m} = machi_projection_store:read_latest_projection(
|
||||
hd(PStores), public),
|
||||
|
@ -160,7 +160,7 @@ partial_stop_restart2() ->
|
|||
Addr_a, TcpPort_a, ?DUMMY_PV1_EPOCH),
|
||||
|
||||
%% Iterate through humming consensus once
|
||||
{now_using,_,Epoch_n} = machi_chain_manager1:test_react_to_env(
|
||||
{now_using,_,Epoch_n} = machi_chain_manager1:trigger_react_to_env(
|
||||
hd(ChMgrs)),
|
||||
true = (Epoch_n > Epoch_m),
|
||||
{ok, {false, EpochID3}} = WedgeStatus(hd(Ps)),
|
||||
|
|
|
@ -47,7 +47,7 @@ smoke_test2() ->
|
|||
{ok, _} = machi_flu_psup:start_flu_package(Name, Port, Dir, [])
|
||||
end || P <- Ps],
|
||||
ok = machi_chain_manager1:set_chain_members(a_chmgr, D),
|
||||
[machi_chain_manager1:test_react_to_env(a_chmgr) || _ <-lists:seq(1,5)],
|
||||
[machi_chain_manager1:trigger_react_to_env(a_chmgr) || _ <-lists:seq(1,5)],
|
||||
|
||||
{ok, Clnt} = ?C:start_link(Ps),
|
||||
try
|
||||
|
|
Loading…
Reference in a new issue