basho/riak_core — pull request #595 by jrwest (2014-05-29 19:03:32+00:00)
Title: plug bg_manager_eqc into eunit and address potential race

previously this eqc was not run as part of the eunit suite (https://github.com/basho/riak_core/issues/485). When plugging it in a found a failure due to a race-condition in the test:

```
1> bg_manager_eqc:run_check().
Starting Quviq QuickCheck version 1.29.1
(compiled at {{2013,6,27},{9,46,39}})
Licence for Basho reserved until {{2014,5,29},{12,7,3}}
Failed!
[{set,{var,2},{call,bg_manager_eqc,set_concurrency_limit,[d,1,false]}},
{set,{var,5},{call,bg_manager_eqc,start_process,[]}},
{set,{var,7},{call,bg_manager_eqc,get_lock,[d,{var,5},[]]}},
{set,{var,11},{call,bg_manager_eqc,stop_process,[{var,5}]}},
{set,{var,13},{call,bg_manager_eqc,all_resources,[all]}}]

Final State:
---------------
alive = true
bypassed = false
enabled = true
procs = [{<0.222.0>,not_running}]
limits = [{d,1}]
locks = [{d,[{#Ref<0.0.0.262>,<0.222.0>,[],released}]}]
counts = []
tokens = []
---------------

background_mgr tables:
---------------
[{enabled,true},{bypassed,false},{{info,d},{resource_info,lock,1,true}}]
---------------
[{{given,d},{resource_entry,d,lock,<0.222.0>,[],#Ref<0.0.0.262>}}]
---------------

bg_manager monitors:
---------------
{monitors,[]}
---------------

bg_manager_eqc:set_concurrency_limit(d, 1, false) -> undefined
bg_manager_eqc:start_process() -> <0.222.0>
bg_manager_eqc:get_lock(d, <0.222.0>, []) -> #Ref<0.0.0.262>
bg_manager_eqc:stop_process(<0.222.0>) -> ok
bg_manager_eqc:all_resources(all) ->
[#bg_stat_live{
resource = d, type = lock, owner = {<0.222.0>, []} }]

Reason: {postcondition, {1, '/=', 0}}
false
```

This PR addresses both those issues.

see comment in changeset for more details