From e0f3cd48d9acaf327077e065621d94664f811bde Mon Sep 17 00:00:00 2001 From: jacekwegr Date: Tue, 7 Nov 2023 21:23:54 +0100 Subject: [PATCH] Make mod_ping tests more reliable --- big_tests/tests/mod_ping_SUITE.erl | 3 +-- big_tests/tests/sm_SUITE.erl | 5 ++++- 2 files changed, 5 insertions(+), 3 deletions(-) diff --git a/big_tests/tests/mod_ping_SUITE.erl b/big_tests/tests/mod_ping_SUITE.erl index 5c67f2c5a3..b46244c9ae 100644 --- a/big_tests/tests/mod_ping_SUITE.erl +++ b/big_tests/tests/mod_ping_SUITE.erl @@ -199,7 +199,6 @@ service_unavailable_response(Config) -> escalus_stanza:iq(domain(), <<"error">>, ErrorStanzaBody), PingId), escalus_client:send(Alice, ErrorStanza), - ct:sleep(timer:seconds(1)), TimeoutAction = ?config(timeout_action, Config), check_connection(TimeoutAction, Alice), escalus_client:kill_connection(Config, Alice) @@ -286,7 +285,7 @@ wait_ping_interval(Ration) -> ct:sleep(WaitTime). check_connection(kill, Client) -> - false = escalus_connection:is_connected(Client); + mongoose_helper:wait_until(fun() -> escalus_connection:is_connected(Client) end, false); check_connection(_, Client) -> true = escalus_connection:is_connected(Client). diff --git a/big_tests/tests/sm_SUITE.erl b/big_tests/tests/sm_SUITE.erl index 4578d39744..29a91030b2 100644 --- a/big_tests/tests/sm_SUITE.erl +++ b/big_tests/tests/sm_SUITE.erl @@ -638,7 +638,10 @@ ping_timeout(Config) -> send_initial_presence(NewAlice), %% check if the error stanza was handled by mod_ping - ?assertEqual(1, length(get_stanzas_filtered_by_mod_ping())), + [Stanza] = get_stanzas_filtered_by_mod_ping(), + escalus:assert(is_iq_error, Stanza), + ?assertNotEqual(undefined, + exml_query:subelement_with_name_and_ns(Stanza, <<"ping">>, <<"urn:xmpp:ping">>)), %% stop the connection escalus_connection:stop(NewAlice).