aboutsummaryrefslogtreecommitdiffstats
path: root/test
diff options
context:
space:
mode:
Diffstat (limited to 'test')
-rw-r--r--test/acceptor_SUITE.erl37
1 files changed, 35 insertions, 2 deletions
diff --git a/test/acceptor_SUITE.erl b/test/acceptor_SUITE.erl
index 547d1c0..7235420 100644
--- a/test/acceptor_SUITE.erl
+++ b/test/acceptor_SUITE.erl
@@ -34,14 +34,17 @@ groups() ->
tcp_max_connections_infinity,
tcp_set_max_connections,
tcp_set_max_connections_clean,
- tcp_upgrade
+ tcp_upgrade,
+ tcp_error_eaddrinuse
]}, {ssl, [
ssl_accept_error,
ssl_accept_socket,
ssl_active_echo,
ssl_echo,
ssl_sni_echo,
- ssl_sni_fail
+ ssl_sni_fail,
+ ssl_error_eaddrinuse,
+ ssl_error_no_cert
]}, {misc, [
misc_bad_transport,
misc_bad_transport_options
@@ -177,6 +180,24 @@ do_ssl_sni_fail() ->
{'EXIT', _} = begin catch ranch:get_port(Name) end,
ok.
+ssl_error_eaddrinuse(_) ->
+ doc("Check that eaddrinuse returns a simplified error."),
+ Name = name(),
+ Opts = ct_helper:get_certs_from_ets(),
+ {ok, _} = ranch:start_listener(Name, 1, ranch_ssl, Opts, active_echo_protocol, []),
+ Port = ranch:get_port(Name),
+ {error, eaddrinuse} = ranch:start_listener({Name, fails}, 1,
+ ranch_ssl, [{port, Port}|Opts], active_echo_protocol, []),
+ ok = ranch:stop_listener(Name),
+ %% Make sure the listener stopped.
+ {'EXIT', _} = begin catch ranch:get_port(Name) end,
+ ok.
+
+ssl_error_no_cert(_) ->
+ doc("Check that missing certificate returns a simplified error."),
+ {error, no_cert} = ranch:start_listener(name(), 1, ranch_ssl, [], active_echo_protocol, []),
+ ok.
+
%% tcp.
tcp_accept_socket(_) ->
@@ -350,6 +371,18 @@ tcp_upgrade(_) ->
receive upgraded -> ok after 1000 -> error(timeout) end,
ok = ranch:stop_listener(Name).
+tcp_error_eaddrinuse(_) ->
+ doc("Check that eaddrinuse returns a simplified error."),
+ Name = name(),
+ {ok, _} = ranch:start_listener(Name, 1, ranch_tcp, [], active_echo_protocol, []),
+ Port = ranch:get_port(Name),
+ {error, eaddrinuse} = ranch:start_listener({Name, fails}, 1,
+ ranch_tcp, [{port, Port}], active_echo_protocol, []),
+ ok = ranch:stop_listener(Name),
+ %% Make sure the listener stopped.
+ {'EXIT', _} = begin catch ranch:get_port(Name) end,
+ ok.
+
%% Supervisor tests
connection_type_supervisor(_) ->