Skip to content

Commit

Permalink
Unit test hardening
Browse files Browse the repository at this point in the history
  • Loading branch information
schlagert committed Nov 10, 2015
1 parent 39b7061 commit 6ad2dc7
Showing 1 changed file with 7 additions and 2 deletions.
9 changes: 7 additions & 2 deletions test/lbm_kv_dist_test.erl
Original file line number Diff line number Diff line change
Expand Up @@ -204,8 +204,8 @@ resolve_conflict() ->
true = net_kernel:connect(OtherSlave),
receive ?NETSPLIT_EVENT -> ok end
end,
ok = slave_execute(Slave1, fun() -> Netsplit(Slave2) end),
ok = slave_execute(Slave2, fun() -> Netsplit(Slave1) end),
ok = slave_execute(Slave1, fun() -> Netsplit(Slave2) end, no_block),
ok = slave_execute(Slave2, fun() -> Netsplit(Slave1) end, no_block),

%% sorry, but there's no event we can wait for...
timer:sleep(1000),
Expand Down Expand Up @@ -289,6 +289,11 @@ slave_setup_env(Node) ->
%% Execute `Fun' on the given node.
%%------------------------------------------------------------------------------
slave_execute(Node, Fun) ->
slave_execute(Node, Fun, sync).
slave_execute(Node, Fun, no_block) ->
spawn(Node, Fun),
ok;
slave_execute(Node, Fun, _) ->
Pid = spawn_link(Node, Fun),
receive
{'EXIT', Pid, normal} -> ok;
Expand Down

0 comments on commit 6ad2dc7

Please sign in to comment.