From a436d8d207aefef2579455df9aed19685154f63a Mon Sep 17 00:00:00 2001 From: Piotr Nosek Date: Thu, 14 Mar 2019 17:14:04 +0100 Subject: [PATCH] Add proper wait for c2s state in sm_SUITE --- big_tests/tests/sm_SUITE.erl | 5 +++-- 1 file changed, 3 insertions(+), 2 deletions(-) diff --git a/big_tests/tests/sm_SUITE.erl b/big_tests/tests/sm_SUITE.erl index f0651c85ac0..576c068513e 100644 --- a/big_tests/tests/sm_SUITE.erl +++ b/big_tests/tests/sm_SUITE.erl @@ -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), @@ -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),