Skip to content

Commit

Permalink
ssl: Add whitebox test for supervisor shutdown
Browse files Browse the repository at this point in the history
  • Loading branch information
IngelaAndin committed Oct 25, 2024
1 parent b6d0e72 commit 63c44ba
Showing 1 changed file with 33 additions and 0 deletions.
33 changes: 33 additions & 0 deletions lib/ssl/test/tls_api_SUITE.erl
Original file line number Diff line number Diff line change
Expand Up @@ -62,6 +62,8 @@
tls_shutdown_both/1,
tls_shutdown_error/0,
tls_shutdown_error/1,
tls_sup_shutdown/0,
tls_sup_shutdown/1,
tls_client_closes_socket/0,
tls_client_closes_socket/1,
tls_closed_in_active_once/0,
Expand Down Expand Up @@ -161,6 +163,7 @@ api_tests() ->
tls_shutdown_write,
tls_shutdown_both,
tls_shutdown_error,
tls_sup_shutdown,
tls_password_correct,
tls_password_incorrect,
tls_password_badarg,
Expand Down Expand Up @@ -784,6 +787,36 @@ tls_tcp_error_propagation_in_active_mode(Config) when is_list(Config) ->

ssl_test_lib:check_result(Client, {ssl_closed, SslSocket}).

%%--------------------------------------------------------------------
tls_sup_shutdown() ->
[{doc,"Test that terminate behaves correctly for exit(shutdown) as done by supervisor at application shutdown"}].
tls_sup_shutdown(Config) when is_list(Config) ->
ClientOpts = ssl_test_lib:ssl_options(client_rsa_opts, Config),
ServerOpts = ssl_test_lib:ssl_options(server_rsa_opts, Config),

{ClientNode, ServerNode, Hostname} = ssl_test_lib:run_where(Config),

Server = ssl_test_lib:start_server([{node, ServerNode}, {port, 0},
{from, self()},
{mfa, {?MODULE, receive_msg, []}},
{options, ServerOpts}]),
Port = ssl_test_lib:inet_port(Server),

{_, #sslsocket{pid=[Pid|_]}} = ssl_test_lib:start_client([return_socket,
{node, ClientNode}, {port, Port},
{host, Hostname},
{from, self()},
{mfa, {ssl_test_lib, no_result, []}},
{options, [{active, false} | ClientOpts]}]),
exit(Pid, shutdown),

receive
{Server, {ssl_closed, _}} ->
ok;
Msg ->
ct:fail(Msg)
end.

%%--------------------------------------------------------------------
tls_reject_warning_alert_in_initial_hs() ->
[{doc,"Test sending warning ALERT instead of client hello"}].
Expand Down

0 comments on commit 63c44ba

Please sign in to comment.