Skip to content

Commit

Permalink
Merge pull request #4307 from esl/fix-tr-util-test
Browse files Browse the repository at this point in the history
Fix a race condition in tr_util tests
  • Loading branch information
arcusfelis authored Jun 19, 2024
2 parents ab579c3 + 250260e commit 11c33c3
Showing 1 changed file with 5 additions and 3 deletions.
8 changes: 5 additions & 3 deletions big_tests/tests/tr_util_SUITE.erl
Original file line number Diff line number Diff line change
Expand Up @@ -62,15 +62,17 @@ c2s_elements_story(Alice, Bob) ->
BobJid = escalus_utils:get_jid(Bob),

%% Get elements exchanged between bare JIDs
[Sent, Recv] = rpc(mim(), tr_util, c2s_elements_between_jids, [[AliceBareJid, BobBareJid]]),
%% There can be more than 2 elements if the hook traces are interleaved
%% between the sender and the receiver
[Sent, Recv | _] = Events =
rpc(mim(), tr_util, c2s_elements_between_jids, [[AliceBareJid, BobBareJid]]),
?assertMatch(#{name := <<"message">>, type := <<"chat">>,
jid := AliceJid, from_jid := AliceJid, to_jid := BobJid}, Sent),
?assertMatch(#{name := <<"message">>, type := <<"chat">>,
jid := BobJid, from_jid := AliceJid, to_jid := BobJid}, Recv),

%% Get elements exchanged between full JIDs
?assertEqual([Sent, Recv],
rpc(mim(), tr_util, c2s_elements_between_jids, [[AliceJid, BobJid]])),
?assertEqual(Events, rpc(mim(), tr_util, c2s_elements_between_jids, [[AliceJid, BobJid]])),

%% Get all elements
AllElements = rpc(mim(), tr_util, c2s_elements, []),
Expand Down

0 comments on commit 11c33c3

Please sign in to comment.