Skip to content

Commit

Permalink
Make mod_ping tests more reliable
Browse files Browse the repository at this point in the history
  • Loading branch information
jacekwegr committed Nov 7, 2023
1 parent 9f74462 commit e0f3cd4
Show file tree
Hide file tree
Showing 2 changed files with 5 additions and 3 deletions.
3 changes: 1 addition & 2 deletions big_tests/tests/mod_ping_SUITE.erl
Original file line number Diff line number Diff line change
Expand Up @@ -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)
Expand Down Expand Up @@ -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).

Expand Down
5 changes: 4 additions & 1 deletion big_tests/tests/sm_SUITE.erl
Original file line number Diff line number Diff line change
Expand Up @@ -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).
Expand Down

0 comments on commit e0f3cd4

Please sign in to comment.