Skip to content

Commit

Permalink
reproduce an issue
Browse files Browse the repository at this point in the history
  • Loading branch information
Eugene Shubin committed Feb 10, 2015
1 parent 96d2025 commit 7899566
Showing 1 changed file with 19 additions and 1 deletion.
20 changes: 19 additions & 1 deletion test/poolboy_tests.erl
Original file line number Diff line number Diff line change
Expand Up @@ -68,7 +68,9 @@ pool_test_() ->
},
{<<"Pool reuses waiting monitor when a worker exits">>,
fun reuses_waiting_monitor_on_worker_exit/0
}
},
{<<"Recover from transaction timeout">>,
fun transaction_timeout/0}
]
}.

Expand All @@ -88,6 +90,22 @@ checkin_worker(Pid, Worker) ->
poolboy:checkin(Pid, Worker),
timer:sleep(500).

transaction_timeout() ->
{ok, Pid} = new_pool(1, 0),
?assertEqual({ready,1,0,0}, pool_call(Pid, status)),
WorkerList = pool_call(Pid, get_all_workers),
?assertMatch([_], WorkerList),
?assertExit(
{timeout, _},
poolboy:transaction(Pid,
fun(Worker) ->
ok = pool_call(Worker, work)
end,
0)),
?assertEqual(WorkerList, pool_call(Pid, get_all_workers)),
?assertEqual({ready,1,0,0}, pool_call(Pid, status)).


pool_startup() ->
%% Check basic pool operation.
{ok, Pid} = new_pool(10, 5),
Expand Down

0 comments on commit 7899566

Please sign in to comment.