Skip to content
Merged
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
29 changes: 15 additions & 14 deletions lib/diameter/test/diameter_tls_SUITE.erl
Original file line number Diff line number Diff line change
Expand Up @@ -50,7 +50,7 @@
end_per_testcase/2,

%% The test cases
parallel/1
test/1
]).

%% diameter callbacks
Expand Down Expand Up @@ -134,15 +134,15 @@ suite() ->
[{timetrap, {seconds, 90}}].

all() ->
[parallel].
[test].

%% Shouldn't really have to know about crypto here but 'ok' from
%% ssl:start() isn't enough to guarantee that TLS is available.
init_per_suite(Config) ->
?TL("init_per_suite -> entry with"
"~n Config: ~p", [Config]),
try
[] == (catch make_certs(dir(Config)))
ok == (catch make_certs(dir(Config)))
orelse throw({?MODULE, no_certs}),
ok == application:start(crypto) orelse throw({?MODULE, no_crypto}),
ok == ssl:start() orelse throw({?MODULE, no_ssl}),
Expand Down Expand Up @@ -186,10 +186,10 @@ end_per_testcase(Case, Config) when is_list(Config) ->

%% ===========================================================================

parallel(Config) ->
?TL("parallel -> entry"),
test(Config) ->
?TL("test -> entry"),
Res = run(dir(Config), false),
?TL("parallel -> done when"
?TL("test -> done when"
"~n Res: ~p", [Res]),
Res.

Expand All @@ -214,7 +214,7 @@ run(Dir, B) ->
ssl:start(),
try
?TL("run -> try run traffic"),
?RUN([{[fun traffic/2, Dir, B], 60000}])
traffic(Dir, B)
after
?TL("run(after) -> stop diameter"),
diameter:stop(),
Expand All @@ -239,7 +239,7 @@ traffic(Dir, false) ->
?TL("traffic(false) -> add transports"),
Connections = add_transports(Dir, Servers),
?TL("traffic(false) -> calls"),
[] = ?RUN([[fun call/1, S] || S <- ?SCRAMBLE(?SERVERS)]),
[ok = call(S) || S <- ?SCRAMBLE(?SERVERS)],
?TL("traffic(false) -> remove transports"),
[] = remove_transports(Connections),
?TL("traffic(false) -> stop (diameter) services"),
Expand All @@ -248,11 +248,12 @@ traffic(Dir, false) ->
ok.

make_certs(Dir) ->
?RUN([[fun make_cert/2, Dir, B] || B <- ["server1",
"server2",
"server4",
"server5",
"client"]]).
[make_cert(Dir, B) || B <- ["server1",
"server2",
"server4",
"server5",
"client"]],
ok.

start_services(Dir) ->
lists:foreach(fun(S) -> ?DEL_REG(S) end, ?SERVERS ++ [?CLIENT]),
Expand All @@ -269,7 +270,7 @@ add_transports(Dir, Servers) ->
%% transport to go down.
remove_transports(Connections) ->
[] = [T || S <- ?SERVERS, T <- [diameter:subscribe(S)], T /= true],
[] = ?RUN([[fun disconnect/1, T] || T <- Connections]),
[disconnect(T) || T <- Connections],
[S || S <- ?SERVERS,
I <- [receive #diameter_event{service = S, info = I} -> I end],
down /= catch element(1, I)].
Expand Down
Loading