Skip to content

Commit

Permalink
Add proper wait for c2s state in sm_SUITE
Browse files Browse the repository at this point in the history
  • Loading branch information
fenek committed Mar 18, 2019
1 parent d817fc6 commit a436d8d
Showing 1 changed file with 3 additions and 2 deletions.
5 changes: 3 additions & 2 deletions big_tests/tests/sm_SUITE.erl
Original file line number Diff line number Diff line change
Expand Up @@ -501,8 +501,9 @@ resume_session_state_send_message(Config) ->

escalus_connection:send(Bob, escalus_stanza:chat_to(common_helper:get_bjid(AliceSpec), <<"msg-1">>)),
%% kill alice connection
{ok, C2SPid} = get_session_pid(AliceSpec, escalus_client:resource(Alice)),
escalus_connection:kill(Alice),
ct:sleep(200), %% alice should be in resume_session_state
wait_for_c2s_state_change(C2SPid, resume_session),

U = proplists:get_value(username, AliceSpec),
S = proplists:get_value(server, AliceSpec),
Expand Down Expand Up @@ -558,7 +559,7 @@ resume_session_state_stop_c2s(Config) ->
%% get pid of c2s and stop him !
C2SRef = rpc(mim(), ejabberd_sm, get_session_pid, [U, S, Res]),
rpc(mim(), ejabberd_c2s, stop, [C2SRef] ),
ct:sleep(1000), %% c2s should be in resume_session_state
wait_for_c2s_state_change(C2SRef, resume_session),

%% alice comes back and receives unacked message
{ok, NewAlice, _} = escalus_connection:start(AliceSpec, ConnSteps),
Expand Down

0 comments on commit a436d8d

Please sign in to comment.