Yay, all tests pass!

This commit is contained in:
Scott Lystig Fritchie 2015-12-07 22:15:23 +09:00
parent 38e63e8181
commit 1bc9033076
3 changed files with 10 additions and 11 deletions

View file

@ -1255,7 +1255,7 @@ react_to_env_A20(Retries, #ch_mgr{name=MyName, proj=P_current}=S) ->
P_none0 = make_none_projection(Epoch, P_none0 = make_none_projection(Epoch,
MyName, All_list, Witness_list, MembersDict), MyName, All_list, Witness_list, MembersDict),
P_none = P_none0#projection_v1{chain_name=ChainName}, P_none = P_none0#projection_v1{chain_name=ChainName},
{{x,y,z,42,77}, S2#ch_mgr{proj=P_none}}; {{x,y,z,42,77}, set_proj(S2, P_none)};
_ -> _ ->
react_to_env_A21(Retries, UnanimousTag, P_latest, ReadExtra, S2) react_to_env_A21(Retries, UnanimousTag, P_latest, ReadExtra, S2)
end. end.
@ -1463,6 +1463,8 @@ react_to_env_A40(Retries, P_newprop, P_latest, LatestUnanimousP,
not ordsets:is_disjoint(P_latest_s, Down_s) not ordsets:is_disjoint(P_latest_s, Down_s)
end, end,
AmExcludedFromLatestAll_p = AmExcludedFromLatestAll_p =
P_latest#projection_v1.epoch_number /= 0
andalso
(not lists:member(MyName, P_latest#projection_v1.all_members)), (not lists:member(MyName, P_latest#projection_v1.all_members)),
?REACT({a40, ?LINE, ?REACT({a40, ?LINE,
[{latest_author, P_latest#projection_v1.author_server}, [{latest_author, P_latest#projection_v1.author_server},
@ -1473,7 +1475,7 @@ react_to_env_A40(Retries, P_newprop, P_latest, LatestUnanimousP,
if if
AmExcludedFromLatestAll_p -> AmExcludedFromLatestAll_p ->
?REACT({a40, ?LINE, []}), ?REACT({a40, ?LINE, [{latest,machi_projection:make_summary(P_latest)}]}),
react_to_env_A50(P_latest, [], S); react_to_env_A50(P_latest, [], S);
AmHosedP -> AmHosedP ->

View file

@ -390,9 +390,8 @@ nonunanimous_setup_and_fix_test() ->
P2 = P2pb#projection_v1{dbg2=[]}, P2 = P2pb#projection_v1{dbg2=[]},
%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%% %%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%
io:format(user, "\n+ Add a 3rd member to the chain.\n", []), %% io:format(user, "\n+ Add a 3rd member to the chain.\n", []),
io:format(user, "\nNOTE: One INFO REPORT will follow.\n", []), io:format(user, "\nNOTE: One INFO REPORT will follow.\n", []),
timer:sleep(50),
MembersDict3 = machi_projection:make_members_dict(P_s), MembersDict3 = machi_projection:make_members_dict(P_s),
ok = machi_chain_manager1:set_chain_members( ok = machi_chain_manager1:set_chain_members(
@ -410,9 +409,8 @@ nonunanimous_setup_and_fix_test() ->
?FLU_PC:read_latest_projection(Pxy, private) || Pxy <- Proxies], ?FLU_PC:read_latest_projection(Pxy, private) || Pxy <- Proxies],
%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%% %%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%
io:format(user, "\n+ Remove 'a' from the chain.\n", []), %% io:format(user, "\n+ Remove 'a' from the chain.\n", []),
io:format(user, "\nNOTE: One INFO REPORT will follow.\n", []), io:format(user, "NOTE: One INFO REPORT will follow.\n", []),
timer:sleep(50),
MembersDict4 = machi_projection:make_members_dict(tl(P_s)), MembersDict4 = machi_projection:make_members_dict(tl(P_s)),
ok = machi_chain_manager1:set_chain_members( ok = machi_chain_manager1:set_chain_members(
@ -430,7 +428,7 @@ nonunanimous_setup_and_fix_test() ->
?FLU_PC:read_latest_projection(Pxy, private) || Pxy <- tl(Proxies)], ?FLU_PC:read_latest_projection(Pxy, private) || Pxy <- tl(Proxies)],
%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%% %%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%
io:format(user, "\n+ Add a to the chain again.\n", []), %% io:format(user, "\n+ Add a to the chain again.\n", []),
MembersDict5 = machi_projection:make_members_dict(P_s), MembersDict5 = machi_projection:make_members_dict(P_s),
ok = machi_chain_manager1:set_chain_members( ok = machi_chain_manager1:set_chain_members(

View file

@ -49,6 +49,8 @@ smoke_test2() ->
end || P <- Ps], end || P <- Ps],
ok = machi_chain_manager1:set_chain_members(a_chmgr, D), ok = machi_chain_manager1:set_chain_members(a_chmgr, D),
[machi_chain_manager1:trigger_react_to_env(a_chmgr) || _ <-lists:seq(1,5)], [machi_chain_manager1:trigger_react_to_env(a_chmgr) || _ <-lists:seq(1,5)],
{ok, PQQ} = machi_projection_store:read_latest_projection(a_pstore, public),
io:format(user, "a's proj: ~w\n", [machi_projection:make_summary(PQQ)]),
{ok, Clnt} = ?C:start_link(Ps), {ok, Clnt} = ?C:start_link(Ps),
try try
@ -64,13 +66,11 @@ smoke_test2() ->
PK = <<>>, PK = <<>>,
Prefix = <<"prefix">>, Prefix = <<"prefix">>,
Chunk1 = <<"Hello, chunk!">>, Chunk1 = <<"Hello, chunk!">>,
io:format(user, "~s LINE ~p\n", [?MODULE, ?LINE]),
{ok, {Off1, Size1, File1}} = {ok, {Off1, Size1, File1}} =
?C:append_chunk(Clnt, PK, Prefix, Chunk1, none, 0), ?C:append_chunk(Clnt, PK, Prefix, Chunk1, none, 0),
true = is_binary(File1), true = is_binary(File1),
Chunk2 = "It's another chunk", Chunk2 = "It's another chunk",
CSum2 = {client_sha, machi_util:checksum_chunk(Chunk2)}, CSum2 = {client_sha, machi_util:checksum_chunk(Chunk2)},
io:format(user, "~s LINE ~p\n", [?MODULE, ?LINE]),
{ok, {Off2, Size2, File2}} = {ok, {Off2, Size2, File2}} =
?C:append_chunk(Clnt, PK, Prefix, Chunk2, CSum2, 1024), ?C:append_chunk(Clnt, PK, Prefix, Chunk2, CSum2, 1024),
Chunk3 = ["This is a ", <<"test,">>, 32, [["Hello, world!"]]], Chunk3 = ["This is a ", <<"test,">>, 32, [["Hello, world!"]]],
@ -115,7 +115,6 @@ io:format(user, "~s LINE ~p\n", [?MODULE, ?LINE]),
LargeBytes = binary:copy(<<"x">>, 1024*1024), LargeBytes = binary:copy(<<"x">>, 1024*1024),
LBCsum = {client_sha, machi_util:checksum_chunk(LargeBytes)}, LBCsum = {client_sha, machi_util:checksum_chunk(LargeBytes)},
io:format(user, "~s LINE ~p\n", [?MODULE, ?LINE]),
{ok, {Offx, Sizex, Filex}} = {ok, {Offx, Sizex, Filex}} =
?C:append_chunk(Clnt, PK, Prefix, LargeBytes, LBCsum, 0), ?C:append_chunk(Clnt, PK, Prefix, LargeBytes, LBCsum, 0),
ok = ?C:trim_chunk(Clnt, Filex, Offx, Sizex), ok = ?C:trim_chunk(Clnt, Filex, Offx, Sizex),