Skip to content

test: log rotation — verify --log-max-size/files/total trigger cleanly #35

@arcaven

Description

@arcaven

What to test

PR #25 added --log-max-size, --log-max-files, --log-max-total flags wired to internal/rlog. The in-memory ring is separate from the on-disk file. We want to confirm that when the active daemon.log crosses the size cap, it's gzipped, rotated archives named daemon.log-<timestamp>.gz appear, retention trims the oldest.

Known constraint

--log-max-size is expressed in MiB and the minimum is 1 (1 MiB). That's higher than ideal for forcing a rotation quickly but it's the floor today. This test is already running on desk — subsequent tests in this epic (crash loops, shift, scale) will drive the log volume up faster and accelerate rotation.

Test plan

  1. marvel daemon --mrvl --log-max-size=1 --log-max-files=3 --log-max-total=10
  2. Let the other tests in this epic generate log volume.
  3. Monitor ls -la ~/.marvel/log/ periodically.
  4. Once daemon.log nears 1 MiB, watch for rotation.

Pass

  • A daemon.log-<timestamp>.gz archive appears when the active file crosses 1 MiB.
  • Active daemon.log truncates back to well under 1 MiB after rotation.
  • --log-max-files=3 — at most 3 gzipped archives + 1 active. Older archives deleted.
  • --log-max-total=10 — total disk usage of log dir never exceeds 10 MiB.
  • gunzip of each archive produces readable log content with no truncation at boundaries.

Fail

  • File grows unbounded past cap.
  • More than --log-max-files archives accumulate.
  • Disk usage exceeds --log-max-total.
  • Corrupted gzip or truncated lines in archives.

Related: PR #25.

Metadata

Metadata

Assignees

No one assigned

    Labels

    priority.p2Medium — should address this sprintscope.in-scopeAccepted, will work ontriage.completeTriage done, ready for worktype.testTest-only changes or a request to verify shipped behavior

    Type

    No type

    Projects

    No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions