WIP: tests: add 12 DB persistence functional tests #96

Closed
jabber.developer2 wants to merge 1 commits from test/db-functional-tests into master
Collaborator

Description:

Summary

Functional tests for database message persistence. All 12 tests exercise the public log_database API through normal UI operations and work with any storage backend.

New tests (test_history.c)

Test What it proves
message_db_history_on_reopen Basic incoming message survives close → reopen
message_db_history_multiple 3 messages from different resources all persist
message_db_history_contact_isolation buddy1 message absent from buddy2 history
message_db_history_special_chars & < > " survive XML decode + DB round-trip
message_db_history_outgoing Sent message appears in history after reopen
message_db_history_dialog Both outgoing and incoming sides preserved
message_db_history_empty No crash when opening chat with no prior messages
message_db_history_long_message 1000+ char body not truncated
message_db_history_newline Embedded LF (&#10;) stored and read back correctly
message_db_history_service_chars `\
message_db_history_verify /history verify reports no issues after writes
message_db_history_lmc XEP-0308 correction replaces original in DB history

Test methodology

Messages are received while the console is focused, so the body is never rendered to the terminal buffer. After close → reopen, prof_output_exact() finding the body in the output conclusively proves it was read from the database.

Group rebalancing

Redistributed tests across 4 parallel groups for roughly even execution time:

Group Count Content
1 19 Connect, Ping, Rooms, Software, LastActivity
2 23 Message, Receipts, Roster, DB History
3 22 Chat Session, Presence, Disconnect
4 21 MUC, Carbons

Previously Chat Session was in Group 2 (29 tests) and Group 3 had only 16. Now all groups are within ±2 of each other.

Verification

Group 1: 19 PASSED    Group 2: 23 PASSED
Group 3: 22 PASSED    Group 4: 21 PASSED
**Description:** ## Summary Functional tests for database message persistence. All 12 tests exercise the public `log_database` API through normal UI operations and work with any storage backend. ## New tests (test_history.c) | Test | What it proves | |------|---------------| | `message_db_history_on_reopen` | Basic incoming message survives close → reopen | | `message_db_history_multiple` | 3 messages from different resources all persist | | `message_db_history_contact_isolation` | buddy1 message absent from buddy2 history | | `message_db_history_special_chars` | `& < > "` survive XML decode + DB round-trip | | `message_db_history_outgoing` | Sent message appears in history after reopen | | `message_db_history_dialog` | Both outgoing and incoming sides preserved | | `message_db_history_empty` | No crash when opening chat with no prior messages | | `message_db_history_long_message` | 1000+ char body not truncated | | `message_db_history_newline` | Embedded LF (`&#10;`) stored and read back correctly | | `message_db_history_service_chars` | `\ | % { } [ ] =` in body don't break storage | | `message_db_history_verify` | `/history verify` reports no issues after writes | | `message_db_history_lmc` | XEP-0308 correction replaces original in DB history | ## Test methodology Messages are received while the console is focused, so the body is **never rendered** to the terminal buffer. After close → reopen, `prof_output_exact()` finding the body in the output conclusively proves it was read from the database. ## Group rebalancing Redistributed tests across 4 parallel groups for roughly even execution time: | Group | Count | Content | |-------|-------|---------| | 1 | 19 | Connect, Ping, Rooms, Software, LastActivity | | 2 | 23 | Message, Receipts, Roster, DB History | | 3 | 22 | Chat Session, Presence, Disconnect | | 4 | 21 | MUC, Carbons | Previously Chat Session was in Group 2 (29 tests) and Group 3 had only 16. Now all groups are within ±2 of each other. ## Verification ``` Group 1: 19 PASSED Group 2: 23 PASSED Group 3: 22 PASSED Group 4: 21 PASSED ```
jabber.developer2 added 1 commit 2026-02-19 13:26:51 +00:00
tests: add 12 DB persistence functional tests, rebalance groups
Some checks failed
CI Code / Check spelling (pull_request) Successful in 19s
CI Code / Check coding style (pull_request) Successful in 42s
CI Code / Code Coverage (pull_request) Failing after 6m0s
CI Code / Linux (debian) (pull_request) Failing after 7m54s
CI Code / Linux (ubuntu) (pull_request) Failing after 7m56s
CI Code / Linux (arch) (pull_request) Failing after 8m11s
be06d33125
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 DB round-trip
- 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 reports no issues
- message_db_history_lmc: XEP-0308 correction replaces original in DB

Rebalance test groups for parallel execution (19/23/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
jabber.developer2 force-pushed test/db-functional-tests from be06d33125 to b289d1a753 2026-02-21 12:04:09 +00:00 Compare
jabber.developer2 changed title from tests: add 12 DB persistence functional tests to WIP: tests: add 12 DB persistence functional tests 2026-02-26 11:40:57 +00:00
jabber.developer2 changed title from WIP: tests: add 12 DB persistence functional tests to tests: add 12 DB persistence functional tests 2026-03-03 15:20:09 +00:00
jabber.developer2 changed title from tests: add 12 DB persistence functional tests to WIP: tests: add 12 DB persistence functional tests 2026-03-03 15:22:29 +00:00
Author
Collaborator

Included in #94

Included in #94
All checks were successful
CI Code / Check spelling (pull_request) Successful in 19s
Required
Details
CI Code / Check coding style (pull_request) Successful in 33s
Required
Details
CI Code / Code Coverage (pull_request) Successful in 5m31s
Required
Details
CI Code / Linux (debian) (pull_request) Successful in 6m51s
Required
Details
CI Code / Linux (ubuntu) (pull_request) Successful in 6m54s
Required
Details
CI Code / Linux (arch) (pull_request) Successful in 7m9s
Required
Details

Pull request closed

Sign in to join this conversation.
No description provided.