aboutsummaryrefslogtreecommitdiffstats
path: root/test
diff options
context:
space:
mode:
authorjuhlig <[email protected]>2019-06-07 17:44:27 +0200
committerLoïc Hoguin <[email protected]>2019-06-20 14:01:14 +0200
commit3a8986a63fce8d153f9e9301d7fbfe58429774bc (patch)
tree95ec39d3df1b7f34f1d3bde322baa9ce5e1bc1ae /test
parentb3695e08787679dfd7dbccbfd5cc407a6751dc2a (diff)
downloadranch-3a8986a63fce8d153f9e9301d7fbfe58429774bc.tar.gz
ranch-3a8986a63fce8d153f9e9301d7fbfe58429774bc.tar.bz2
ranch-3a8986a63fce8d153f9e9301d7fbfe58429774bc.zip
Log imminent kills from havoc suite
Diffstat (limited to 'test')
-rw-r--r--test/havoc_SUITE.erl17
1 files changed, 11 insertions, 6 deletions
diff --git a/test/havoc_SUITE.erl b/test/havoc_SUITE.erl
index d47267a..0d89afa 100644
--- a/test/havoc_SUITE.erl
+++ b/test/havoc_SUITE.erl
@@ -29,14 +29,12 @@ init_per_suite(Config) ->
ok = application:start(havoc),
%% Comment to hide progress reports in the terminal.
application:set_env(kernel, logger_sasl_compatible, true),
- ok = application:start(sasl),
%% Enable logging of progress reports.
%% They will only be available in the HTML reports by default.
ok = logger:set_primary_config(level, info),
Config.
end_per_suite(_) ->
- ok = application:stop(sasl),
ok = application:stop(havoc),
ok = application:stop(ranch).
@@ -50,17 +48,24 @@ havoc_tcp(_) ->
{ok, _} = ranch:start_listener(Name,
ranch_tcp, #{},
echo_protocol, []),
- Port = ranch:get_port(Name),
+ Port1 = ranch:get_port(Name),
%% Establish a hundred connections.
_ = [begin
- {ok, Socket} = gen_tcp:connect("localhost", Port, [{active, false}]),
+ {ok, Socket} = gen_tcp:connect("localhost", Port1, [{active, false}]),
Socket
end || _ <- lists:seq(1, 100)],
%% Run Havoc.
- havoc:on([{applications, [ranch]}]),
+ 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),
havoc:off(),
timer:sleep(1000),
%% Confirm we can still connect.
- {ok, _} = gen_tcp:connect("localhost", Port, [{active, false}]),
+ Port2 = ranch:get_port(Name),
+ {ok, _} = gen_tcp:connect("localhost", Port2, [{active, false}]),
ok = ranch:stop_listener(Name).