Skip to content

Commit

Permalink
plug bg_manager_eqc into eunit and address potential race
Browse files Browse the repository at this point in the history
see comment in changeset for more details
  • Loading branch information
jrwest committed May 29, 2014
1 parent ebdfbdd commit 960b83c
Showing 1 changed file with 18 additions and 1 deletion.
19 changes: 18 additions & 1 deletion test/bg_manager_eqc.erl
Expand Up @@ -26,6 +26,8 @@
-include_lib("eqc/include/eqc.hrl").
-include_lib("eqc/include/eqc_statem.hrl").
-include_lib("eunit/include/eunit.hrl").
-define(QC_OUT(P),
eqc:on_output(fun(Str, Args) -> io:format(user, Str, Args) end, P)).

-compile(export_all).

Expand Down Expand Up @@ -54,6 +56,13 @@
tokens :: [{bg_eqc_type(), non_neg_integer()}]
}).

bgmgr_test_() ->
{timeout, 60,
fun() ->
?assert(eqc:quickcheck(?QC_OUT(eqc:testing_time(30, prop_bgmgr()))))
end
}.

run_eqc() ->
run_eqc(100).

Expand Down Expand Up @@ -274,7 +283,15 @@ stop_process_pre(S, [Pid]) ->
%% @doc stop_process command
stop_process(Pid) ->
Pid ! die,
wait_for_pid(Pid).
Res = wait_for_pid(Pid),
%% while not part of the test, this provides extra insurance that the
%% background manager receives the monitor message for the failed pid
%% (waiting for the test process to receive its monitor message is not
%% enough). This relies on local erlang message semantics a bit and may
%% not be bullet proof. The catch handles the case where the bg manager
%% has been crashed by the test.
catch riak_core_bg_manager:enabled(),
Res.

%% @doc state transition for stop_process command
stop_process_next(S=#state{procs=Procs}, _Value, [Pid]) ->
Expand Down

11 comments on commit 960b83c

@reiddraper
Copy link
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

+1 for now just to kick off the integration build. I haven't done review yet, but will +1 separately once I've finished with review.

@borshop
Copy link
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

saw approval from reiddraper
at 960b83c

@borshop
Copy link
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

merging basho/riak_core/bugfix/jrw/bg-mgr-eqc-fixes = 960b83c into borshop-integration-595-bugfix/jrw/bg-mgr-eqc-fixes

@borshop
Copy link
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

basho/riak_core/bugfix/jrw/bg-mgr-eqc-fixes = 960b83c merged ok, testing candidate = 409f86e

@borshop
Copy link
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

@reiddraper
Copy link
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

@borshop: retry

@borshop
Copy link
Contributor

@borshop borshop commented on 960b83c Jun 4, 2014

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

saw approval from reiddraper
at 960b83c

@borshop
Copy link
Contributor

@borshop borshop commented on 960b83c Jun 4, 2014

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

merging basho/riak_core/bugfix/jrw/bg-mgr-eqc-fixes = 960b83c into borshop-integration-595-bugfix/jrw/bg-mgr-eqc-fixes

@borshop
Copy link
Contributor

@borshop borshop commented on 960b83c Jun 4, 2014

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

basho/riak_core/bugfix/jrw/bg-mgr-eqc-fixes = 960b83c merged ok, testing candidate = bafa066

@borshop
Copy link
Contributor

@borshop borshop commented on 960b83c Jun 4, 2014

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

@borshop
Copy link
Contributor

@borshop borshop commented on 960b83c Jun 4, 2014

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

fast-forwarding develop to borshop-integration-595-bugfix/jrw/bg-mgr-eqc-fixes = bafa066

Please sign in to comment.