Compare commits

..

1 Commits

Author SHA1 Message Date
b289d1a753 tests: add functional tests for DB message persistence, rebalance groups
All checks were successful
CI Code / Check spelling (pull_request) Successful in 19s
CI Code / Check coding style (pull_request) Successful in 33s
CI Code / Code Coverage (pull_request) Successful in 5m31s
CI Code / Linux (debian) (pull_request) Successful in 6m51s
CI Code / Linux (ubuntu) (pull_request) Successful in 6m54s
CI Code / Linux (arch) (pull_request) Successful in 7m9s
Add backend-agnostic functional tests for database message persistence.
All tests work with both SQLite and flat-file backends.

New tests in test_history.c:
- message_db_history_on_reopen: basic incoming write+read round-trip
- message_db_history_multiple: 3 messages from different resources
- message_db_history_contact_isolation: buddy1 msg absent from buddy2
- message_db_history_special_chars: XML entities survive decode+DB
- message_db_history_outgoing: sent message persists across reopen
- message_db_history_dialog: outgoing + incoming both in history
- message_db_history_empty: no crash on contact with no history
- message_db_history_long_message: 1000+ char body not truncated
- message_db_history_newline: embedded LF stored correctly
- message_db_history_service_chars: backslash pipe percent braces etc
- message_db_history_verify: /history verify (ifdef HAVE_HISTORY_VERIFY)
- message_db_history_lmc: XEP-0308 correction replaces original in DB

Rebalance test groups for parallel execution (19/22/22/21):
- Group 1: Connect, Ping, Rooms, Software, LastActivity
- Group 2: Message, Receipts, Roster, DB History
- Group 3: Chat Session, Presence, Disconnect
- Group 4: MUC, Carbons
2026-02-21 15:03:41 +03:00
3 changed files with 7 additions and 1 deletions

View File

@@ -16,7 +16,7 @@
*
* Tests are organized into groups for better maintainability and parallel execution:
* Group 1: Connect, Ping, Rooms, Software, Last Activity (19 tests)
* Group 2: Message, Receipts, Roster, DB History (23 tests)
* Group 2: Message, Receipts, Roster, DB History (22 tests)
* Group 3: Chat Session, Presence, Disconnect (22 tests)
* Group 4: MUC, Carbons (21 tests)
*
@@ -147,7 +147,9 @@ main(int argc, char* argv[])
PROF_FUNC_TEST(message_db_history_long_message),
PROF_FUNC_TEST(message_db_history_newline),
PROF_FUNC_TEST(message_db_history_service_chars),
#ifdef HAVE_HISTORY_VERIFY
PROF_FUNC_TEST(message_db_history_verify),
#endif
PROF_FUNC_TEST(message_db_history_lmc),
};

View File

@@ -385,6 +385,7 @@ message_db_history_service_chars(void **state)
assert_true(prof_output_exact("svc: a\\b c|d e%f {g} [h] i=j"));
}
#ifdef HAVE_HISTORY_VERIFY
/*
* Test: /history verify reports no issues after normal message writes.
*/
@@ -415,6 +416,7 @@ message_db_history_verify(void **state)
prof_input("/history verify");
assert_true(prof_output_exact("Verification complete: no issues found."));
}
#endif /* HAVE_HISTORY_VERIFY */
/*
* Test: LMC (Last Message Correction, XEP-0308) — incoming correction

View File

@@ -8,5 +8,7 @@ void message_db_history_empty(void **state);
void message_db_history_long_message(void **state);
void message_db_history_newline(void **state);
void message_db_history_service_chars(void **state);
#ifdef HAVE_HISTORY_VERIFY
void message_db_history_verify(void **state);
#endif
void message_db_history_lmc(void **state);