Welcome to mirror list, hosted at ThFree Co, Russian Federation.

github.com/processone/ejabberd.git - Unnamed repository; edit this file 'description' to name the repository.
summaryrefslogtreecommitdiff
path: root/test
diff options
context:
space:
mode:
authorHolger Weiss <holger@zedat.fu-berlin.de>2015-04-16 09:45:17 +0300
committerHolger Weiss <holger@zedat.fu-berlin.de>2015-04-16 09:45:17 +0300
commit01b3defb8656ec783367096b4248855c1129b226 (patch)
tree70853c1a458e0db64684d17a357ee39ba5da5ac8 /test
parentd6247534106c0f668ec7a5abe29a641a3064036d (diff)
CSI test: Fix race when slave becomes active again
Make sure the server processed the slave's active request after the previous test stanzas were received by the slave and before the final Chat State notification is sent by the master.
Diffstat (limited to 'test')
-rw-r--r--test/ejabberd_SUITE.erl20
1 files changed, 11 insertions, 9 deletions
diff --git a/test/ejabberd_SUITE.erl b/test/ejabberd_SUITE.erl
index 1c247694c..1577513ff 100644
--- a/test/ejabberd_SUITE.erl
+++ b/test/ejabberd_SUITE.erl
@@ -1575,16 +1575,17 @@ client_state_master(Config) ->
Message = #message{to = Peer, thread = <<"1">>,
sub_els = [#chatstate{type = active}]},
wait_for_slave(Config),
- %% Should be queued (but see below):
- send(Config, Presence),
- %% Should be sent immediately, together with the previous presence:
- send(Config, Message#message{body = [#text{data = <<"body">>}]}),
%% Should be dropped:
send(Config, Message),
%% Should be queued (but see below):
- send(Config, Presence),
+ send(Config, Presence#presence{type = unavailable}),
%% Should replace the previous presence in the queue:
+ send(Config, Presence),
+ %% Should be sent immediately, together with the previous presence:
+ send(Config, Message#message{body = [#text{data = <<"body">>}]}),
+ %% Should be queued:
send(Config, Presence#presence{type = unavailable}),
+ %% Wait for the slave to become active.
wait_for_slave(Config),
%% Should be sent immediately, as the client is active again.
send(Config, Message),
@@ -1601,11 +1602,12 @@ client_state_slave(Config) ->
?recv1(#presence{from = Peer, sub_els = [#vcard_xupdate{}|_]}),
?recv1(#message{from = Peer, thread = <<"1">>, sub_els = [#chatstate{type = active}],
body = [#text{data = <<"body">>}]}),
- wait_for_master(Config),
send(Config, #csi{type = active}),
- ?recv2(#presence{from = Peer, type = unavailable,
- sub_els = [#delay{}, #legacy_delay{}]},
- #message{from = Peer, thread = <<"1">>,
+ %% The server now flushes the queue, so we receive the following presence.
+ ?recv1(#presence{from = Peer, type = unavailable,
+ sub_els = [#delay{}, #legacy_delay{}]}),
+ wait_for_master(Config),
+ ?recv1(#message{from = Peer, thread = <<"1">>,
sub_els = [#chatstate{type = active}]}),
disconnect(Config).