diff options
author | Anders Svensson <[email protected]> | 2016-06-11 08:28:41 +0200 |
---|---|---|
committer | Anders Svensson <[email protected]> | 2016-06-11 08:28:41 +0200 |
commit | f027ac4d0f1d522e3b3d5c4695baf42a5cdd5330 (patch) | |
tree | 5ad4a775aab432b7d8a83bdfc66318234942c73d /lib/diameter/test | |
parent | 78eeb8b231791c23c40ea6c653ef2962bc52ba6f (diff) | |
parent | 80dc4f14b21cf316a8000f91cd77b1f0653afa7c (diff) | |
download | otp-f027ac4d0f1d522e3b3d5c4695baf42a5cdd5330.tar.gz otp-f027ac4d0f1d522e3b3d5c4695baf42a5cdd5330.tar.bz2 otp-f027ac4d0f1d522e3b3d5c4695baf42a5cdd5330.zip |
Merge branch 'anders/diameter/19/listen/OTP-13611'
* anders/diameter/19/listen/OTP-13611:
Fix leaking transports in traffic/relay suites
Close listening sockets at transport removal
Don't restart transport processes after transport removal
Rename diameter_reg:del -> remove
Add diameter_reg:subscribe/2
Add dialyzer specs to diameter_reg
Remove diameter_reg:repl/2
Remove diameter_reg bloat
Diffstat (limited to 'lib/diameter/test')
-rw-r--r-- | lib/diameter/test/diameter_reg_SUITE.erl | 19 | ||||
-rw-r--r-- | lib/diameter/test/diameter_relay_SUITE.erl | 12 | ||||
-rw-r--r-- | lib/diameter/test/diameter_traffic_SUITE.erl | 6 | ||||
-rw-r--r-- | lib/diameter/test/diameter_transport_SUITE.erl | 6 | ||||
-rw-r--r-- | lib/diameter/test/diameter_util.erl | 11 |
5 files changed, 29 insertions, 25 deletions
diff --git a/lib/diameter/test/diameter_reg_SUITE.erl b/lib/diameter/test/diameter_reg_SUITE.erl index 3d9ad8bfa8..e2a1ca00c3 100644 --- a/lib/diameter/test/diameter_reg_SUITE.erl +++ b/lib/diameter/test/diameter_reg_SUITE.erl @@ -33,8 +33,7 @@ %% testcases -export([add/1, add_new/1, - del/1, - repl/1, + remove/1, terms/1, pids/1]). @@ -56,8 +55,7 @@ groups() -> tc() -> [add, add_new, - del, - repl, + remove, terms, pids]. @@ -82,20 +80,11 @@ add_new(_) -> true = ?reg:add_new(Ref), false = ?reg:add_new(Ref). -del(_) -> +remove(_) -> Ref = make_ref(), true = ?reg:add_new(Ref), true = ?reg:add_new({Ref}), - true = ?reg:del({Ref}), - [{Ref, Pid}] = ?reg:match(Ref), - Pid = self(). - -repl(_) -> - Ref = make_ref(), - true = ?reg:add_new({Ref}), - true = ?reg:repl({Ref}, Ref), - false = ?reg:add_new(Ref), - false = ?reg:repl({Ref}, Ref), + true = ?reg:remove({Ref}), [{Ref, Pid}] = ?reg:match(Ref), Pid = self(). diff --git a/lib/diameter/test/diameter_relay_SUITE.erl b/lib/diameter/test/diameter_relay_SUITE.erl index f766f54a80..b5e520e642 100644 --- a/lib/diameter/test/diameter_relay_SUITE.erl +++ b/lib/diameter/test/diameter_relay_SUITE.erl @@ -171,8 +171,9 @@ connect(Config) -> Conns)). disconnect(Config) -> - lists:foreach(fun({{CN,CR},{SN,SR}}) -> ?util:disconnect(CN,CR,SN,SR) end, - ?util:read_priv(Config, "cfg")). + [] = [{T,C} || C <- ?util:read_priv(Config, "cfg"), + T <- [break(C)], + T /= ok]. stop_services(_Config) -> [] = [{H,T} || H <- ?SERVICES, @@ -184,6 +185,13 @@ stop(_Config) -> %% ---------------------------------------- +break({{CN,CR},{SN,SR}}) -> + try + ?util:disconnect(CN,CR,SN,SR) + after + diameter:remove_transport(SN, SR) + end. + server(Name, Dict) -> ok = diameter:start_service(Name, ?SERVICE(Name, Dict)), {Name, ?util:listen(Name, tcp)}. diff --git a/lib/diameter/test/diameter_traffic_SUITE.erl b/lib/diameter/test/diameter_traffic_SUITE.erl index 976abf9138..6f3a4801ee 100644 --- a/lib/diameter/test/diameter_traffic_SUITE.erl +++ b/lib/diameter/test/diameter_traffic_SUITE.erl @@ -428,7 +428,11 @@ remove_transports(Config) -> server_service = SN} = group(Config), [LRef | Cs] = ?util:read_priv(Config, "transport"), - [?util:disconnect(CN, C, SN, LRef) || C <- Cs]. + try + [] = [T || C <- Cs, T <- [?util:disconnect(CN, C, SN, LRef)], T /= ok] + after + ok = diameter:remove_transport(SN, LRef) + end. stop_services(Config) -> #group{client_service = CN, diff --git a/lib/diameter/test/diameter_transport_SUITE.erl b/lib/diameter/test/diameter_transport_SUITE.erl index 53d2d6660e..f2884eacb4 100644 --- a/lib/diameter/test/diameter_transport_SUITE.erl +++ b/lib/diameter/test/diameter_transport_SUITE.erl @@ -1,7 +1,7 @@ %% %% %CopyrightBegin% %% -%% Copyright Ericsson AB 2010-2015. All Rights Reserved. +%% Copyright Ericsson AB 2010-2016. All Rights Reserved. %% %% Licensed under the Apache License, Version 2.0 (the "License"); %% you may not use this file except in compliance with the License. @@ -140,7 +140,9 @@ sctp_accept(Config) -> -define(PEER_COUNT, 8). accept(Prot) -> - T = {Prot, make_ref()}, + Ref = make_ref(), + true = diameter_reg:add_new({diameter_config, transport, Ref}), %% fake it + T = {Prot, Ref}, [] = ?util:run(?util:scramble(acc(2*?PEER_COUNT, T, []))). acc(0, _, Acc) -> diff --git a/lib/diameter/test/diameter_util.erl b/lib/diameter/test/diameter_util.erl index 52b747e99c..f26f1e999a 100644 --- a/lib/diameter/test/diameter_util.erl +++ b/lib/diameter/test/diameter_util.erl @@ -345,11 +345,12 @@ transport(SvcName, Ref) -> disconnect(Client, Ref, Server, LRef) -> true = diameter:subscribe(Server), ok = diameter:remove_transport(Client, Ref), - ok = receive - {diameter_event, Server, {down, LRef, _, _}} -> ok - after 10000 -> - {Client, Ref, Server, LRef, process_info(self(), messages)} - end. + receive + {diameter_event, Server, {down, LRef, _, _}} -> + ok + after 10000 -> + {Client, Ref, Server, LRef, process_info(self(), messages)} + end. %% --------------------------------------------------------------------------- |