File 2061-megaco-test-Add-skip-if-timeouts-when-starting-MGC-o.patch of Package erlang
From c9135e7cf6b281e548663714f8f88a306d21aff4 Mon Sep 17 00:00:00 2001
From: Micael Karlberg <bmk@erlang.org>
Date: Wed, 26 Jun 2024 17:42:31 +0200
Subject: [PATCH] [megaco|test] Add skip if timeouts when starting MGC or MG
---
lib/megaco/test/megaco_actions_SUITE.erl | 18 ++++++++++++++++--
1 file changed, 16 insertions(+), 2 deletions(-)
diff --git a/lib/megaco/test/megaco_actions_SUITE.erl b/lib/megaco/test/megaco_actions_SUITE.erl
index ac634988a7..916fe22b77 100644
--- a/lib/megaco/test/megaco_actions_SUITE.erl
+++ b/lib/megaco/test/megaco_actions_SUITE.erl
@@ -312,7 +312,7 @@ req_and_rep([MgcNode, Mg1Node, Mg2Node],
%% Start the MGC and MGs
i("req_and_rep -> start the MGC"),
ET = [{Codec, EC, tcp}, {Codec, EC, udp}],
- {ok, Mgc} = mgc_start(MgcNode, ET),
+ Mgc = start(fun() -> mgc_start(MgcNode, ET) end, mgc_start_timeout),
i("req_and_rep -> start and connect the MGs"),
MgConf0 = [{Mg1Node, "mg1", Codec, EC, tcp, ?MG_VERBOSITY},
@@ -402,7 +402,8 @@ connect_mg([{Node, Name, Codec, EC, Trans, Verb}|Mg], Acc) ->
connect_mg(Node, Name, Codec, EC, Trans, Verb) ->
Mid = {deviceName, Name},
- {ok, Pid} = ?MG_START(Node, Mid, Codec, EC, Trans, Verb),
+ Pid = start(fun() -> ?MG_START(Node, Mid, Codec, EC, Trans, Verb) end,
+ mg_start_timeout),
{ok, _} = ?MG_EAR(Pid, true),
@@ -468,6 +469,19 @@ await_load_complete(MGs0) ->
end.
+%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%
+
+%% Start the 'unit' (MGC or MG).
+%% If it fails for reason = timeout, we issue an skip.
+start(Exec, Reason) ->
+ case Exec() of
+ {ok, Pid} ->
+ Pid;
+ {error, timeout} ->
+ ?SKIP(Reason)
+ end.
+
+
%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%
make_node_name(Name) ->
--
2.43.0