aboutsummaryrefslogtreecommitdiffstats
path: root/lib/ssh/test
diff options
context:
space:
mode:
authorHans Nilsson <[email protected]>2014-05-05 16:42:14 +0200
committerHans Nilsson <[email protected]>2014-05-09 11:13:42 +0200
commit77ab185507c597112dd5039176ed5d9c65e84632 (patch)
tree46a47c6a2f2f1e50567cde7ba92e2e49b6ad46b8 /lib/ssh/test
parentc5979e269c01789546f03660930e3991ee1037b8 (diff)
downloadotp-77ab185507c597112dd5039176ed5d9c65e84632.tar.gz
otp-77ab185507c597112dd5039176ed5d9c65e84632.tar.bz2
otp-77ab185507c597112dd5039176ed5d9c65e84632.zip
ssh: test case for connect_timeout in ssh:connect
Diffstat (limited to 'lib/ssh/test')
-rw-r--r--lib/ssh/test/ssh_basic_SUITE.erl22
1 files changed, 22 insertions, 0 deletions
diff --git a/lib/ssh/test/ssh_basic_SUITE.erl b/lib/ssh/test/ssh_basic_SUITE.erl
index a8b64b1425..f9814dd09e 100644
--- a/lib/ssh/test/ssh_basic_SUITE.erl
+++ b/lib/ssh/test/ssh_basic_SUITE.erl
@@ -48,6 +48,7 @@ all() ->
server_password_option,
server_userpassword_option,
double_close,
+ ssh_connect_timeout,
{group, hardening_tests}
].
@@ -629,6 +630,27 @@ double_close(Config) when is_list(Config) ->
ok = ssh:close(CM).
%%--------------------------------------------------------------------
+ssh_connect_timeout() ->
+ [{doc, "Test connect_timeout option in ssh:connect/4"}].
+ssh_connect_timeout(_Config) ->
+ ConnTimeout = 2000,
+ {error,{faked_transport,connect,TimeoutToTransport}} =
+ ssh:connect("localhost", 12345,
+ [{transport,{tcp,?MODULE,tcp_closed}},
+ {connect_timeout,ConnTimeout}],
+ 1000),
+ case TimeoutToTransport of
+ ConnTimeout -> ok;
+ Other ->
+ ct:log("connect_timeout is ~p but transport received ~p",[ConnTimeout,Other]),
+ {fail,"ssh:connect/4 wrong connect_timeout received in transport"}
+ end.
+
+%% Help for the test above
+connect(_Host, _Port, _Opts, Timeout) ->
+ {error, {faked_transport,connect,Timeout}}.
+
+%%--------------------------------------------------------------------
openssh_zlib_basic_test() ->
[{doc, "Test basic connection with openssh_zlib"}].