aboutsummaryrefslogtreecommitdiffstats
path: root/test/havoc_SUITE.erl
diff options
context:
space:
mode:
authorjuhlig <[email protected]>2019-06-19 14:43:46 +0200
committerLoïc Hoguin <[email protected]>2019-06-20 14:01:15 +0200
commit3bcdf71f95572ebb807ebb6cef6e017ec78c2b11 (patch)
treef56fb0f38bc78820aa51b961452ac5273ff31fce /test/havoc_SUITE.erl
parent3a8986a63fce8d153f9e9301d7fbfe58429774bc (diff)
downloadranch-3bcdf71f95572ebb807ebb6cef6e017ec78c2b11.tar.gz
ranch-3bcdf71f95572ebb807ebb6cef6e017ec78c2b11.tar.bz2
ranch-3bcdf71f95572ebb807ebb6cef6e017ec78c2b11.zip
Make havoc kill supervisors
Diffstat (limited to 'test/havoc_SUITE.erl')
-rw-r--r--test/havoc_SUITE.erl12
1 files changed, 7 insertions, 5 deletions
diff --git a/test/havoc_SUITE.erl b/test/havoc_SUITE.erl
index 0d89afa..238f73b 100644
--- a/test/havoc_SUITE.erl
+++ b/test/havoc_SUITE.erl
@@ -27,8 +27,6 @@ all() ->
init_per_suite(Config) ->
{ok, _} = application:ensure_all_started(ranch),
ok = application:start(havoc),
- %% Comment to hide progress reports in the terminal.
- application:set_env(kernel, logger_sasl_compatible, true),
%% Enable logging of progress reports.
%% They will only be available in the HTML reports by default.
ok = logger:set_primary_config(level, info),
@@ -54,15 +52,19 @@ havoc_tcp(_) ->
{ok, Socket} = gen_tcp:connect("localhost", Port1, [{active, false}]),
Socket
end || _ <- lists:seq(1, 100)],
- %% Run Havoc.
+ %% Log process info of process about to be killed.
LogFun = fun
(Pid) when is_pid(Pid) ->
logger:info("~p~n", [erlang:process_info(Pid)]);
(Port) when is_port(Port) ->
logger:info("~p~n", [erlang:port_info(Port)])
end,
- havoc:on([{applications, [ranch]}, {prekill_callback, LogFun}]),
- timer:sleep(60000),
+ %% Don't kill faster than ranch_sup can handle.
+ KillInterval = 1000 * application:get_env(ranch, ranch_sup_period, 5),
+ %% Run Havoc.
+ havoc:on([{avg_wait, KillInterval}, {deviation, 0}, {applications, [ranch]},
+ supervisor, {prekill_callback, LogFun}]),
+ timer:sleep(10000),
havoc:off(),
timer:sleep(1000),
%% Confirm we can still connect.