diff --git a/big_tests/tests/pep_SUITE.erl b/big_tests/tests/pep_SUITE.erl index 67eedd1c18..0a3452787a 100644 --- a/big_tests/tests/pep_SUITE.erl +++ b/big_tests/tests/pep_SUITE.erl @@ -56,7 +56,7 @@ all() -> ]. groups() -> - [ + G = [ {pep_tests, [parallel], [ disco_test, @@ -81,7 +81,8 @@ groups() -> unsubscribe_after_presence_unsubscription ] } - ]. + ], + ct_helper:repeat_all_until_any_fail(G, 100). suite() -> require_rpc_nodes([mim]) ++ escalus:suite(). @@ -108,11 +109,8 @@ init_per_group(_GroupName, Config) -> dynamic_modules:ensure_modules(domain(), required_modules()), Config. -end_per_group(cache_tests, Config) -> - dynamic_modules:restore_modules(Config); - end_per_group(_GroupName, Config) -> - Config. + dynamic_modules:restore_modules(Config). init_per_testcase(TestName, Config) -> escalus:init_per_testcase(TestName, Config). @@ -289,7 +287,7 @@ delayed_receive_with_sm_story(Config, Alice, Bob) -> enable_sm(Alice), enable_sm(Bob), publish_with_sm(Alice, <<"item2">>, {pep, NodeNS}, []), - [Message] = make_friends(Bob, Alice), + [Message] = make_friends_sm(Bob, Alice), Node = {escalus_utils:get_short_jid(Alice), NodeNS}, pubsub_tools:check_item_notification(Message, <<"item2">>, Node, []). @@ -508,20 +506,31 @@ send_presence(From, Type, To) -> escalus_client:send(From, Stanza). make_friends(Bob, Alice) -> - % makes uni-directional presence subscriptions + % makes uni-directional presence subscriptions while SM is disabled + % returns stanzas received finally by the inviter + send_presence(Bob, <<"subscribe">>, Alice), + escalus:assert_many([is_iq], escalus_client:wait_for_stanzas(Bob, 1)), + escalus:assert_many([is_presence], escalus_client:wait_for_stanzas(Alice, 1)), + send_presence(Alice, <<"subscribed">>, Bob), + escalus:assert_many([is_iq], escalus_client:wait_for_stanzas(Alice, 1)), + escalus:assert_many([is_message, is_iq] + ++ lists:duplicate(2, is_presence), + BobStanzas = escalus_client:wait_for_stanzas(Bob, 4)), + lists:filter(fun(S) -> escalus_pred:is_message(S) end, BobStanzas). + +make_friends_sm(Bob, Alice) -> + % makes uni-directional presence subscriptions while SM is enabled % returns stanzas received finally by the inviter send_presence(Bob, <<"subscribe">>, Alice), + escalus:assert_many([is_iq, is_sm_ack_request], escalus_client:wait_for_stanzas(Bob, 2)), + escalus:assert_many([is_presence, is_sm_ack_request], escalus_client:wait_for_stanzas(Alice, 2)), send_presence(Alice, <<"subscribed">>, Bob), - escalus:wait_for_stanzas(Alice, 10, 200), - BobStanzas = escalus:wait_for_stanzas(Bob, 10, 200), - lists:filter(fun(S) -> N = S#xmlel.name, - N =/= <<"iq">> - andalso - N =/= <<"presence">> - andalso - N =/= <<"r">> - end, - BobStanzas). + escalus:assert_many([is_iq, is_sm_ack_request], escalus_client:wait_for_stanzas(Alice, 2)), + escalus:assert_many([is_message, is_iq] + ++ lists:duplicate(2, is_presence) + ++ lists:duplicate(4, is_sm_ack_request), + BobStanzas = escalus_client:wait_for_stanzas(Bob, 8)), + lists:filter(fun(S) -> escalus_pred:is_message(S) end, BobStanzas). publish_with_sm(User, ItemId, Node, Options) -> Id = id(User, Node, <<"publish">>),