diff options
author | Hans Nilsson <[email protected]> | 2018-12-21 12:43:39 +0100 |
---|---|---|
committer | Hans Nilsson <[email protected]> | 2018-12-21 17:16:30 +0100 |
commit | c9cc06c9e3545716e7a5dba8d6bfaf2cf8ef0078 (patch) | |
tree | 41293cda1c1758275b932e99c92ad8cbfd0a4c22 | |
parent | e6bf92e6e1a691bba97ea3d339fdab1872b823b3 (diff) | |
download | otp-c9cc06c9e3545716e7a5dba8d6bfaf2cf8ef0078.tar.gz otp-c9cc06c9e3545716e7a5dba8d6bfaf2cf8ef0078.tar.bz2 otp-c9cc06c9e3545716e7a5dba8d6bfaf2cf8ef0078.zip |
ssh: Add port close test
-rw-r--r-- | lib/ssh/test/ssh_basic_SUITE.erl | 20 |
1 files changed, 20 insertions, 0 deletions
diff --git a/lib/ssh/test/ssh_basic_SUITE.erl b/lib/ssh/test/ssh_basic_SUITE.erl index 365f25fabb..0131654dd0 100644 --- a/lib/ssh/test/ssh_basic_SUITE.erl +++ b/lib/ssh/test/ssh_basic_SUITE.erl @@ -37,6 +37,7 @@ cli/1, close/1, daemon_already_started/1, + daemon_error_closes_port/1, daemon_opt_fd/1, multi_daemon_opt_fd/1, double_close/1, @@ -108,6 +109,7 @@ all() -> {group, internal_error}, {group, rsa_host_key_is_actualy_ecdsa}, daemon_already_started, + daemon_error_closes_port, double_close, daemon_opt_fd, multi_daemon_opt_fd, @@ -797,6 +799,24 @@ daemon_already_started(Config) when is_list(Config) -> ssh:stop_daemon(Pid). %%-------------------------------------------------------------------- +%%% Test that a failed daemon start does not leave the port open +daemon_error_closes_port(Config) -> + GoodSystemDir = proplists:get_value(data_dir, Config), + Port = ssh_test_lib:inet_port(), + {error,_} = ssh_test_lib:daemon(Port, []), % No system dir + case ssh_test_lib:daemon(Port, [{system_dir, GoodSystemDir}]) of + {error,eaddrinuse} -> + {fail, "Port leakage"}; + {error,Error} -> + ct:log("Strange error: ~p",[Error]), + {fail, "Strange error"}; + {Pid, _Host, Port} -> + %% Ok + ssh:stop_daemon(Pid) + end. + + +%%-------------------------------------------------------------------- %%% check that known_hosts is updated correctly known_hosts(Config) when is_list(Config) -> SystemDir = proplists:get_value(data_dir, Config), |