From 3bcdf71f95572ebb807ebb6cef6e017ec78c2b11 Mon Sep 17 00:00:00 2001 From: juhlig Date: Wed, 19 Jun 2019 14:43:46 +0200 Subject: Make havoc kill supervisors --- test/havoc_SUITE.erl | 12 +++++++----- 1 file changed, 7 insertions(+), 5 deletions(-) (limited to 'test') 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. -- cgit v1.2.3