Work-around racy query of wedge_status in machi_cr_client_test

This commit is contained in:
Scott Lystig Fritchie 2015-10-14 16:28:01 +09:00
parent 8eb9cc9700
commit 7439a2738d

View file

@ -230,7 +230,15 @@ witness_smoke_test2() ->
orddict:fetch(OurWitness, D),
{ok, {false, EpochID2}} = machi_flu1_client:wedge_status(WitA, WitP),
machi_flu1:wedge_myself(WitName, EpochID2),
{ok, {true, EpochID2}} = machi_flu1_client:wedge_status(WitA, WitP),
case machi_flu1_client:wedge_status(WitA, WitP) of
{ok, {true, EpochID2}} ->
ok;
{ok, {false, EpochID2}} ->
%% This is racy. Work around it by sleeping a while.
timer:sleep(6*1000),
{ok, {true, EpochID2}} =
machi_flu1_client:wedge_status(WitA, WitP)
end,
%% Chunk1 is still readable: not affected by wedged witness head.
{ok, Chunk1} = machi_cr_client:read_chunk(C1, File1, Off1, Size1),