aboutsummaryrefslogtreecommitdiffstats
path: root/test
diff options
context:
space:
mode:
authorjuhlig <[email protected]>2019-06-07 17:04:32 +0200
committerLoïc Hoguin <[email protected]>2019-06-13 13:09:11 +0200
commite5e30f3d122de27a50a922d4f84040b622321dbe (patch)
tree93c72758dbea99567068f0cf4433d9429feb06ae /test
parentb986eae8289e2c5c485397bcd4abe89ef51ebd9a (diff)
downloadranch-e5e30f3d122de27a50a922d4f84040b622321dbe.tar.gz
ranch-e5e30f3d122de27a50a922d4f84040b622321dbe.tar.bz2
ranch-e5e30f3d122de27a50a922d4f84040b622321dbe.zip
Filter expected errors from test output
Diffstat (limited to 'test')
-rw-r--r--test/acceptor_SUITE.erl17
1 files changed, 15 insertions, 2 deletions
diff --git a/test/acceptor_SUITE.erl b/test/acceptor_SUITE.erl
index 3e65830..b6ddea4 100644
--- a/test/acceptor_SUITE.erl
+++ b/test/acceptor_SUITE.erl
@@ -1202,8 +1202,21 @@ supervisor_changed_options_restart(_) ->
{ok, [{send_timeout, 300001}]}
= inet:getopts(do_get_listener_socket(ListenerSupPid1), [send_timeout]),
%% Crash the listener_sup process, allow a short time for restart to succeed.
- exit(ListenerSupPid1, kill),
- timer:sleep(1000),
+ %% We silence the excepted log events coming from the relevant supervisors.
+ ListenerChilds = [ChildPid || {_, ChildPid, _, _} <- supervisor:which_children(ListenerSupPid1)],
+ FilterFun = fun (#{meta := #{pid := EventPid}}, _) ->
+ case lists:member(EventPid, ListenerChilds) of
+ true -> stop;
+ false -> ignore
+ end
+ end,
+ ok = logger:add_primary_filter(?MODULE, {FilterFun, undefined}),
+ try
+ exit(ListenerSupPid1, kill),
+ timer:sleep(1000)
+ after
+ ok = logger:remove_primary_filter(?MODULE)
+ end,
%% Obtain pid of restarted listener_sup process.
[ListenerSupPid2] = [Pid || {{ranch_listener_sup, Ref}, Pid, supervisor, _}
<- supervisor:which_children(ranch_sup), Ref =:= Name],