diff options
author | Anders Svensson <[email protected]> | 2011-10-17 12:15:46 +0200 |
---|---|---|
committer | Anders Svensson <[email protected]> | 2011-10-17 12:15:46 +0200 |
commit | 7f6d6349514a62fa7a66dae9b01a8e5f364826fb (patch) | |
tree | 524fc42d7fb215fc8af9693a4ac759ea8aa95627 /lib/diameter/test/diameter_traffic_SUITE.erl | |
parent | aa4cc46bc6c5dfb292246f86be1981b761d29c26 (diff) | |
parent | 9c9be3b8315c99477e1017fd736ef5ed40459b2f (diff) | |
download | otp-7f6d6349514a62fa7a66dae9b01a8e5f364826fb.tar.gz otp-7f6d6349514a62fa7a66dae9b01a8e5f364826fb.tar.bz2 otp-7f6d6349514a62fa7a66dae9b01a8e5f364826fb.zip |
Merge branch 'anders/diameter/testsuites/OTP-9620'
* anders/diameter/testsuites/OTP-9620:
Add failover suite
Use util to simplify connection establishment in suites
Move certificate generation into own testcase
Add beam target to makefile
Add util functions for managing connections
Use tcp/sctp port resolution from testsuites
Diffstat (limited to 'lib/diameter/test/diameter_traffic_SUITE.erl')
-rw-r--r-- | lib/diameter/test/diameter_traffic_SUITE.erl | 47 |
1 files changed, 3 insertions, 44 deletions
diff --git a/lib/diameter/test/diameter_traffic_SUITE.erl b/lib/diameter/test/diameter_traffic_SUITE.erl index f6905473b7..6704f24532 100644 --- a/lib/diameter/test/diameter_traffic_SUITE.erl +++ b/lib/diameter/test/diameter_traffic_SUITE.erl @@ -127,19 +127,6 @@ {module, ?MODULE}, {answer_errors, callback}]}]). -%% Config for diameter:add_transport/2. In the listening case, listen -%% on a free port that we then lookup using the implementation detail -%% that diameter_tcp registers the port with diameter_reg. --define(CONNECT(PortNr), - {connect, [{transport_module, diameter_tcp}, - {transport_config, [{raddr, ?ADDR}, - {rport, PortNr}, - {ip, ?ADDR}, - {port, 0}]}]}). --define(LISTEN, - {listen, [{transport_module, diameter_tcp}, - {transport_config, [{ip, ?ADDR}, {port, 0}]}]}). - -define(SUCCESS, ?'DIAMETER_BASE_RESULT-CODE_DIAMETER_SUCCESS'). -define(COMMAND_UNSUPPORTED, @@ -253,21 +240,6 @@ tc() -> send_multiple_filters_3, send_anything]. -portnr() -> - portnr(20). - -portnr(N) - when 0 < N -> - case diameter_reg:match({diameter_tcp, listener, '_'}) of - [{T, _Pid}] -> - {_, _, {_LRef, {_Addr, LSock}}} = T, - {ok, PortNr} = inet:port(LSock), - PortNr; - [] -> - receive after 50 -> ok end, - portnr(N-1) - end. - %% =========================================================================== %% start/stop testcases @@ -279,26 +251,13 @@ start_services(_Config) -> ok = diameter:start_service(?CLIENT, ?SERVICE(?CLIENT)). add_transports(Config) -> - {ok, LRef} = diameter:add_transport(?SERVER, ?LISTEN), - true = diameter:subscribe(?CLIENT), - {ok, CRef} = diameter:add_transport(?CLIENT, ?CONNECT(portnr())), - {up, CRef, _Peer, _Cfg, #diameter_packet{}} - = receive #diameter_event{service = ?CLIENT, info = I} -> I - after 2000 -> false - end, - true = diameter:unsubscribe(?CLIENT), + LRef = ?util:listen(?SERVER, tcp), + CRef = ?util:connect(?CLIENT, tcp, LRef), ?util:write_priv(Config, "transport", {LRef, CRef}). -%% Remove the client transport and expect the server transport to -%% go down. remove_transports(Config) -> {LRef, CRef} = ?util:read_priv(Config, "transport"), - true = diameter:subscribe(?SERVER), - ok = diameter:remove_transport(?CLIENT, CRef), - {down, LRef, _, _} - = receive #diameter_event{service = ?SERVER, info = I} -> I - after 2000 -> false - end. + ?util:disconnect(?CLIENT, CRef, ?SERVER, LRef). stop_services(_Config) -> ok = diameter:stop_service(?CLIENT), |