Skip to content

Commit a13ee79

Browse files
arcusfelisfenek
authored andcommitted
Fix a race condition in rest_client_SUITE (#1813)
1 parent 4eb48c3 commit a13ee79

File tree

1 file changed

+8
-2
lines changed

1 file changed

+8
-2
lines changed

big_tests/tests/rest_client_SUITE.erl

Lines changed: 8 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -666,7 +666,7 @@ add_contact_and_invite(Config) ->
666666
% another roster push
667667
Push2 = escalus:wait_for_stanza(Bob),
668668
escalus:assert(is_roster_set, Push2),
669-
ct:pal("Push2: ~p", [Push2]),
669+
ct:log("Push2: ~p", [Push2]),
670670
% she receives a subscription request
671671
Sub = escalus:wait_for_stanza(Alice),
672672
escalus:assert(is_presence_with_type, [<<"subscribe">>], Sub),
@@ -688,8 +688,14 @@ add_contact_and_invite(Config) ->
688688
escalus_stanza:presence_direct(
689689
escalus_client:short_jid(Bob),
690690
<<"subscribed">>)),
691+
%% Wait for push before trying to query endpoint
692+
%% If we just call endpoint,
693+
%% the "subscribed" stanza can not yet be processed.
694+
Push3 = escalus:wait_for_stanza(Bob),
695+
ct:log("Push3 ~p", [Push3]),
696+
escalus:assert(is_roster_set, Push3),
697+
691698
% now check Bob's roster
692-
timer:sleep(100),
693699
{?OK, R4} = gett(client, "/contacts", BCred),
694700
Result4 = decode_maplist(R4),
695701
[Res4] = Result4,

0 commit comments

Comments
 (0)