aboutsummaryrefslogtreecommitdiffstats
path: root/lib/ssl
diff options
context:
space:
mode:
authorIngela Anderton Andin <[email protected]>2012-09-25 11:47:38 +0200
committerIngela Anderton Andin <[email protected]>2012-09-25 11:47:38 +0200
commitd3d0048deb56b548b6636e7f04e0e0bf126aacd9 (patch)
tree66efab557fe296d07dcc7c6e5660497a73d66d46 /lib/ssl
parentb58ce62a0cf296ca8cd8cd77b053bc70ecf28758 (diff)
downloadotp-d3d0048deb56b548b6636e7f04e0e0bf126aacd9.tar.gz
otp-d3d0048deb56b548b6636e7f04e0e0bf126aacd9.tar.bz2
otp-d3d0048deb56b548b6636e7f04e0e0bf126aacd9.zip
ssl: Adopt test case to not take so long
Diffstat (limited to 'lib/ssl')
-rw-r--r--lib/ssl/src/ssl_manager.erl2
-rw-r--r--lib/ssl/test/ssl_basic_SUITE.erl21
2 files changed, 13 insertions, 10 deletions
diff --git a/lib/ssl/src/ssl_manager.erl b/lib/ssl/src/ssl_manager.erl
index af2bfa394d..0cf4f2ce33 100644
--- a/lib/ssl/src/ssl_manager.erl
+++ b/lib/ssl/src/ssl_manager.erl
@@ -191,7 +191,7 @@ init([Name, Opts]) ->
proplists:get_value(session_lifetime, Opts, ?'24H_in_sec'),
CertDb = ssl_certificate_db:create(),
SessionCache = CacheCb:init(proplists:get_value(session_cb_init_args, Opts, [])),
- Timer = erlang:send_after(SessionLifeTime * 1000,
+ Timer = erlang:send_after(SessionLifeTime * 1000 + 5000,
self(), validate_sessions),
erlang:send_after(?CLEAR_PEM_CACHE, self(), clear_pem_cache),
{ok, #state{certificate_db = CertDb,
diff --git a/lib/ssl/test/ssl_basic_SUITE.erl b/lib/ssl/test/ssl_basic_SUITE.erl
index 93f7209aea..6cf712fa6f 100644
--- a/lib/ssl/test/ssl_basic_SUITE.erl
+++ b/lib/ssl/test/ssl_basic_SUITE.erl
@@ -39,6 +39,7 @@
-define(EXPIRE, 10).
-define(SLEEP, 500).
-define(RENEGOTIATION_DISABLE_TIME, 12000).
+-define(CLEAN_SESSION_DB, 60000).
%% Test server callback functions
%%--------------------------------------------------------------------
@@ -108,12 +109,12 @@ init_per_testcase(protocol_versions, Config) ->
init_per_testcase(reuse_session_expired, Config0) ->
Config = lists:keydelete(watchdog, 1, Config0),
- Dog = ssl_test_lib:timetrap(?EXPIRE * 1000 * 5),
ssl:stop(),
application:load(ssl),
application:set_env(ssl, session_lifetime, ?EXPIRE),
+ application:set_env(ssl, session_delay_cleanup_time, 500),
ssl:start(),
- [{watchdog, Dog} | Config];
+ Config;
init_per_testcase(empty_protocol_versions, Config) ->
ssl:stop(),
@@ -141,6 +142,7 @@ init_per_testcase(_TestCase, Config0) ->
%%--------------------------------------------------------------------
end_per_testcase(reuse_session_expired, Config) ->
application:unset_env(ssl, session_lifetime),
+ application:unset_env(ssl, session_delay_cleanup_time),
end_per_testcase(default_action, Config);
end_per_testcase(_TestCase, Config) ->
@@ -2089,13 +2091,14 @@ reuse_session_expired(Config) when is_list(Config) ->
%% Make sure session is unregistered due to expiration
test_server:sleep((?EXPIRE+1)),
[{session_id, Id} |_] = SessionInfo,
+
make_sure_expired(Hostname, Port, Id),
Client2 =
ssl_test_lib:start_client([{node, ClientNode},
- {port, Port}, {host, Hostname},
+ {port, Port}, {host, Hostname},
{mfa, {ssl_test_lib, session_info_result, []}},
- {from, self()}, {options, ClientOpts}]),
+ {from, self()}, {options, ClientOpts}]),
receive
{Client2, SessionInfo} ->
test_server:fail(session_reused_when_session_expired);
@@ -2113,16 +2116,16 @@ make_sure_expired(Host, Port, Id) ->
[_, _,_, _, Prop] = StatusInfo,
State = ssl_test_lib:state(Prop),
Cache = element(2, State),
- case ssl_session_cache:lookup(Cache, {{Host, Port}, Id}) of
+
+ case ssl_session_cache:lookup(Cache, {{Host, Port}, Id}) of
undefined ->
- ok;
+ ok;
#session{is_resumable = false} ->
- ok;
+ ok;
_ ->
test_server:sleep(?SLEEP),
make_sure_expired(Host, Port, Id)
- end.
-
+ end.
%%--------------------------------------------------------------------
server_does_not_want_to_reuse_session(doc) ->