diff options
author | Micael Karlberg <[email protected]> | 2019-07-22 14:54:53 +0200 |
---|---|---|
committer | Micael Karlberg <[email protected]> | 2019-07-22 14:54:53 +0200 |
commit | 056e3dfa2837f52e7e2d074d5cc11543a7656cde (patch) | |
tree | 4a95d2366cb302b8ecf23441cbde294f8d34749a /lib/megaco | |
parent | 9295544658711636e21fd11e41d3d23169248c7d (diff) | |
download | otp-056e3dfa2837f52e7e2d074d5cc11543a7656cde.tar.gz otp-056e3dfa2837f52e7e2d074d5cc11543a7656cde.tar.bz2 otp-056e3dfa2837f52e7e2d074d5cc11543a7656cde.zip |
[megaco|test] Message in "wrong" order cause test case fail
It looked like two messages was received in the "wrong" order,
cuasing the request_and_reply_plain test case tro fail (on
a windows machine).
On closer inspection, the reason was that an "unconditional"
receive was made when waiting for a (disconnect) callback.
But instead we received a secondary message. So, remove
the unconditional receive and instead introduce a timeout
(10 seconds).
Diffstat (limited to 'lib/megaco')
-rw-r--r-- | lib/megaco/test/megaco_mess_test.erl | 47 | ||||
-rw-r--r-- | lib/megaco/test/megaco_mess_user_test.erl | 14 |
2 files changed, 32 insertions, 29 deletions
diff --git a/lib/megaco/test/megaco_mess_test.erl b/lib/megaco/test/megaco_mess_test.erl index d3216c2a6d..cf8b39fe24 100644 --- a/lib/megaco/test/megaco_mess_test.erl +++ b/lib/megaco/test/megaco_mess_test.erl @@ -281,6 +281,8 @@ -define(VERSION, 1). +-define(USER_MOD, megaco_mess_user_test). + -define(TEST_VERBOSITY, debug). -define(MGC_VERBOSITY, debug). -define(MG_VERBOSITY, debug). @@ -303,20 +305,20 @@ -define(MG_NOTIF_RAR(Pid), megaco_test_mg:notify_request_and_reply(Pid)). -define(SEND(Expr), - ?VERIFY(ok, megaco_mess_user_test:apply_proxy(fun() -> Expr end))). + ?VERIFY(ok, ?USER_MOD:apply_proxy(fun() -> Expr end))). -define(USER(Expected, Reply), - megaco_mess_user_test:reply(?MODULE, - ?LINE, - fun(Actual) -> - case ?VERIFY(Expected, Actual) of - Expected -> {ok, Reply}; - UnExpected -> {error, {reply_verify, - ?MODULE, - ?LINE, - UnExpected}} - end - end)). + ?USER_MOD:reply(?MODULE, + ?LINE, + fun(Actual) -> + case ?VERIFY(Expected, Actual) of + Expected -> {ok, Reply}; + UnExpected -> {error, {reply_verify, + ?MODULE, + ?LINE, + UnExpected}} + end + end)). %% t() -> megaco_test_lib:t(?MODULE). %% t(Case) -> megaco_test_lib:t({?MODULE, Case}). @@ -491,12 +493,12 @@ request_and_reply_plain(suite) -> request_and_reply_plain(Config) when is_list(Config) -> ?ACQUIRE_NODES(1, Config), d("request_and_reply_plain -> start proxy",[]), - megaco_mess_user_test:start_proxy(), + ?USER_MOD:start_proxy(), PrelMid = preliminary_mid, MgMid = ipv4_mid(4711), MgcMid = ipv4_mid(), - UserMod = megaco_mess_user_test, + UserMod = ?USER_MOD, d("request_and_reply_plain -> start megaco app",[]), ?VERIFY(ok, application:start(megaco)), UserConfig = [{user_mod, UserMod}, {send_mod, UserMod}, @@ -564,6 +566,7 @@ request_and_reply_plain(Config) when is_list(Config) -> ok. + %%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%% %% OTP-4760 @@ -6866,12 +6869,12 @@ dist(Config) when is_list(Config) -> ?SKIP("Needs a re-write..."), [_Local, Dist] = ?ACQUIRE_NODES(2, Config), d("dist -> start proxy",[]), - megaco_mess_user_test:start_proxy(), + ?USER_MOD:start_proxy(), PrelMid = preliminary_mid, MgMid = ipv4_mid(4711), MgcMid = ipv4_mid(), - UserMod = megaco_mess_user_test, + UserMod = ?USER_MOD, d("dist -> start megaco app",[]), ?VERIFY(ok, application:start(megaco)), UserConfig = [{user_mod, UserMod}, {send_mod, UserMod}, @@ -6977,7 +6980,7 @@ dist(Config) when is_list(Config) -> ?RECEIVE([]), d("dist -> stop proxy",[]), - megaco_mess_user_test:stop_proxy(), + ?USER_MOD:stop_proxy(), d("dist -> done", []), ok. @@ -8362,7 +8365,7 @@ otp_6253(Config) when is_list(Config) -> MgMid = ipv4_mid(4711), ?VERIFY(ok, application:start(megaco)), - ?VERIFY(ok, megaco:start_user(MgMid, [{send_mod, megaco_mess_user_test}, + ?VERIFY(ok, megaco:start_user(MgMid, [{send_mod, ?USER_MOD}, {request_timer, infinity}, {reply_timer, infinity}])), @@ -11015,12 +11018,12 @@ otp_6865_request_and_reply_plain_extra1(Config) when is_list(Config) -> ok = megaco_tc_controller:insert(extra_transport_info, ExtraInfo), d("start proxy",[]), - megaco_mess_user_test:start_proxy(), + ?USER_MOD:start_proxy(), PrelMid = preliminary_mid, MgMid = ipv4_mid(4711), MgcMid = ipv4_mid(), - UserMod = megaco_mess_user_test, + UserMod = ?USER_MOD, d("start megaco app",[]), ?VERIFY(ok, application:start(megaco)), UserConfig = [{user_mod, UserMod}, {send_mod, UserMod}, @@ -12832,13 +12835,13 @@ otp_7713(Config) when is_list(Config) -> i("starting"), d("start proxy",[]), - megaco_mess_user_test:start_proxy(), + ?USER_MOD:start_proxy(), Extra = otp7713_extra, PrelMid = preliminary_mid, MgMid = ipv4_mid(4711), MgcMid = ipv4_mid(), - UserMod = megaco_mess_user_test, + UserMod = ?USER_MOD, d("start megaco app",[]), ?VERIFY(ok, application:start(megaco)), UserConfig = [{user_mod, UserMod}, {send_mod, UserMod}, diff --git a/lib/megaco/test/megaco_mess_user_test.erl b/lib/megaco/test/megaco_mess_user_test.erl index b5a554112e..609c941769 100644 --- a/lib/megaco/test/megaco_mess_user_test.erl +++ b/lib/megaco/test/megaco_mess_user_test.erl @@ -86,13 +86,13 @@ reply(Mod, Line, Fun) when is_function(Fun) -> {?MODULE, Pid, UserCallback} -> UserReply = Fun(UserCallback), Pid ! {?MODULE, self(), UserReply}, - UserReply; - Other -> - megaco_test_lib:error(Other, Mod, Line), - {error, Other} -%% after 1000 -> -%% megaco_test_lib:error(timeout, Mod, Line), -%% {error, timeout} + UserReply%% ; + %% Other -> + %% megaco_test_lib:error(Other, Mod, Line), + %% {error, Other} + after 10000 -> + megaco_test_lib:error(timeout, Mod, Line), + {error, timeout} end. call(UserCallback) -> |