test: add functional tests for autoping (XEP-0199)
Some checks failed
CI Code / Check spelling (pull_request) Successful in 22s
CI Code / Check coding style (pull_request) Successful in 37s
CI Code / Linux (debian) (pull_request) Successful in 6m35s
CI Code / Code Coverage (pull_request) Successful in 9m5s
CI Code / Linux (arch) (pull_request) Successful in 11m0s
CI Code / Linux (ubuntu) (pull_request) Failing after 14m2s

- autoping_set_interval: verify /autoping set command
- autoping_set_zero_disables: verify disabling autoping
- autoping_timeout_set: verify /autoping timeout command
- autoping_timeout_zero_disables: verify disabling timeout
- autoping_sends_ping_after_interval: verify automatic ping IQ
- autoping_server_not_supporting_ping: verify error handling

Fast tests (command parsing) in Group 1, slow tests (timer-based) in Group 3.
This commit is contained in:
2026-02-10 17:47:26 +03:00
parent 467222d0ca
commit a01afb34b4
4 changed files with 140 additions and 2 deletions

View File

@@ -15,9 +15,9 @@
* functional tests run less frequently than unit tests.
*
* Tests are organized into groups for better maintainability and parallel execution:
* Group 1: Connect, Ping, Rooms, Software
* Group 1: Connect, Ping, Autoping (fast), Rooms, Software, Last Activity
* Group 2: Message, Receipts, Roster, Chat Session
* Group 3: Presence, Disconnect
* Group 3: Presence, Disconnect, Autoping (slow)
* Group 4: MUC, Carbons
*
* Parallel execution:
@@ -53,6 +53,7 @@
#include "test_muc.h"
#include "test_disconnect.h"
#include "test_lastactivity.h"
#include "test_autoping.h"
/* Macro to wrap each test with setup/teardown functions */
#define PROF_FUNC_TEST(test) cmocka_unit_test_setup_teardown(test, init_prof_test, close_prof_test)
@@ -95,6 +96,12 @@ main(int argc, char* argv[])
PROF_FUNC_TEST(ping_jid),
PROF_FUNC_TEST(ping_jid_not_supported),
/* Autoping command tests - fast, no waiting */
PROF_FUNC_TEST(autoping_set_interval),
PROF_FUNC_TEST(autoping_set_zero_disables),
PROF_FUNC_TEST(autoping_timeout_set),
PROF_FUNC_TEST(autoping_timeout_zero_disables),
/* Room discovery - XEP-0045 */
PROF_FUNC_TEST(rooms_query),
@@ -165,6 +172,10 @@ main(int argc, char* argv[])
/* Disconnect - clean session termination */
PROF_FUNC_TEST(disconnect_ends_session),
/* Autoping slow tests - require sleep for timer triggers */
PROF_FUNC_TEST(autoping_sends_ping_after_interval),
PROF_FUNC_TEST(autoping_server_not_supporting_ping),
};
/* ============================================================