From a3239c4cab777c610c2639f35f896d793ef44a98 Mon Sep 17 00:00:00 2001 From: Micael Karlberg Date: Thu, 7 Nov 2024 14:37:14 +0100 Subject: [PATCH] [megaco|test] Fixed test for inet_backend test run(s) --- lib/megaco/test/megaco_test_lib.erl | 24 +++++++++++++++--------- 1 file changed, 15 insertions(+), 9 deletions(-) diff --git a/lib/megaco/test/megaco_test_lib.erl b/lib/megaco/test/megaco_test_lib.erl index e854475e507a..e2288218ac3e 100644 --- a/lib/megaco/test/megaco_test_lib.erl +++ b/lib/megaco/test/megaco_test_lib.erl @@ -3199,19 +3199,25 @@ explicit_inet_backend() -> false end. +%% We cannot use application:get_all_env(megaco) since that only "works" +%% when the application has been started and this function may be called +%% well before that happens. test_inet_backends() -> - case application:get_all_env(megaco) of - Env when is_list(Env) -> - case lists:keysearch(test_inet_backends, 1, Env) of - {value, {test_inet_backends, true}} -> - true; - _ -> - false - end; + case init:get_argument(megaco) of + {ok, Args} when is_list(Args) -> + test_inet_backends(Args); _ -> - false + false end. +test_inet_backends([]) -> + false; +test_inet_backends([["test_inet_backends","true"]|_]) -> + true; +test_inet_backends([_|Args]) -> + test_inet_backends(Args). + + inet_backend_opts(Config) when is_list(Config) -> case lists:keysearch(socket_create_opts, 1, Config) of {value, {socket_create_opts, InetBackendOpts}} ->