Skip to content

test: harden retention scheduler coverage#23

Open
xsmyile wants to merge 1 commit intomasterfrom
test/retention-hardening
Open

test: harden retention scheduler coverage#23
xsmyile wants to merge 1 commit intomasterfrom
test/retention-hardening

Conversation

@xsmyile
Copy link
Copy Markdown
Member

@xsmyile xsmyile commented Apr 18, 2026

Summary

  • extract a deterministic retention tick from the background scheduler
  • add direct tests for purge, trim, no-op, and emitted events
  • keep the runtime loop behavior unchanged while making it verifiable

Splits the retention background loop into run_retention_tick so tests can
drive the actual scheduler logic deterministically by injecting the "now"
timestamp. Adds unit tests covering:

- no-op when both retention_hours and max_messages are disabled
- time-based purge removes rows older than the cutoff
- max_messages trim removes the expected oldest rows
- MessageDelete WsEvents match the deleted ids, including combined
  purge + trim passes

Previously these paths were only exercised via repository-level tests,
leaving the scheduler's event emission and branching untested.
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

1 participant