aboutsummaryrefslogtreecommitdiffstats
path: root/test/acceptor_SUITE.erl
diff options
context:
space:
mode:
Diffstat (limited to 'test/acceptor_SUITE.erl')
-rw-r--r--test/acceptor_SUITE.erl24
1 files changed, 23 insertions, 1 deletions
diff --git a/test/acceptor_SUITE.erl b/test/acceptor_SUITE.erl
index ca8c856..861ea33 100644
--- a/test/acceptor_SUITE.erl
+++ b/test/acceptor_SUITE.erl
@@ -49,6 +49,7 @@
-export([supervisor_clean_child_restart/1]).
-export([supervisor_conns_alive/1]).
-export([supervisor_server_recover_state/1]).
+-export([supervisor_clean_conns_sup_restart/1]).
%% ct.
@@ -77,7 +78,8 @@ groups() ->
supervisor_clean_restart,
supervisor_clean_child_restart,
supervisor_conns_alive,
- supervisor_server_recover_state
+ supervisor_server_recover_state,
+ supervisor_clean_conns_sup_restart
]}].
init_per_suite(Config) ->
@@ -499,6 +501,26 @@ supervisor_server_recover_state(_) ->
_ = erlang:trace(all, false, [all]),
ok = clean_traces().
+supervisor_clean_conns_sup_restart(_) ->
+ %% Verify that a conns_sup can not register with the same Name as an already
+ %% registered conns_sup that is still alive. Make sure this does not crash
+ %% the ranch_server.
+ Name = supervisor_clean_conns_sup_restart,
+ {ok, _} = ranch:start_listener(Name,
+ 1, ranch_tcp, [{port, 0}], echo_protocol, []),
+ Server = erlang:whereis(ranch_server),
+ ServerMonRef = erlang:monitor(process, Server),
+ %% Exit because Name already registered and is alive.
+ {'EXIT', _} = (catch ranch_server:set_connections_sup(Name, self())),
+ receive
+ {'DOWN', ServerMonRef, process, Server, _} ->
+ error(ranch_server_down)
+ after
+ 1000 ->
+ ok
+ end,
+ ranch:stop_listener(Name).
+
%% Utility functions.
connect_loop(_, 0, _) ->