aboutsummaryrefslogtreecommitdiffstats
path: root/lib/ssl/test/tls_api_SUITE.erl
diff options
context:
space:
mode:
authorIngela Anderton Andin <[email protected]>2019-07-22 16:37:53 +0200
committerIngela Anderton Andin <[email protected]>2019-07-23 08:55:29 +0200
commite01231b85d641a9b993995ad711ad21591c8b780 (patch)
tree0cf517fb9a3600bc0aebbb5bf672c5df294ead47 /lib/ssl/test/tls_api_SUITE.erl
parentc5545f2b6d10f4d524d6dcbc9013cb9aa19ccaa9 (diff)
downloadotp-e01231b85d641a9b993995ad711ad21591c8b780.tar.gz
otp-e01231b85d641a9b993995ad711ad21591c8b780.tar.bz2
otp-e01231b85d641a9b993995ad711ad21591c8b780.zip
ssl: Move alert test to own suite
Also clean up code after previous test moves
Diffstat (limited to 'lib/ssl/test/tls_api_SUITE.erl')
-rw-r--r--lib/ssl/test/tls_api_SUITE.erl26
1 files changed, 25 insertions, 1 deletions
diff --git a/lib/ssl/test/tls_api_SUITE.erl b/lib/ssl/test/tls_api_SUITE.erl
index 18e17679ac..6a61e844c5 100644
--- a/lib/ssl/test/tls_api_SUITE.erl
+++ b/lib/ssl/test/tls_api_SUITE.erl
@@ -69,7 +69,8 @@ api_tests() ->
tls_tcp_error_propagation_in_active_mode,
peername,
sockname,
- tls_server_handshake_timeout
+ tls_server_handshake_timeout,
+ transport_close
].
init_per_suite(Config0) ->
@@ -575,6 +576,29 @@ tls_server_handshake_timeout(Config) ->
[] = supervisor:which_children(tls_connection_sup)
end
end.
+transport_close() ->
+ [{doc, "Test what happens if socket is closed on TCP level after a while of normal operation"}].
+transport_close(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, {ssl_test_lib, send_recv_result, []}},
+ {options, [{active, false} | ServerOpts]}]),
+ Port = ssl_test_lib:inet_port(Server),
+ {ok, TcpS} = rpc:call(ClientNode, gen_tcp, connect,
+ [Hostname,Port,[binary, {active, false}]]),
+ {ok, SslS} = rpc:call(ClientNode, ssl, connect,
+ [TcpS,[{active, false}|ClientOpts]]),
+
+ ct:log("Testcase ~p, Client ~p Server ~p ~n",
+ [self(), self(), Server]),
+ ok = ssl:send(SslS, "Hello world"),
+ {ok,<<"Hello world">>} = ssl:recv(SslS, 11),
+ gen_tcp:close(TcpS),
+ {error, _} = ssl:send(SslS, "Hello world").
%%--------------------------------------------------------------------
%% Internal functions ------------------------------------------------