Skip to content

[TEST-05] state crate has 90 unit tests but zero integration / persistence / crash-recovery tests #274

@intendednull

Description

@intendednull

Commit: 2f26d91 · Finding: TEST-05

Problem

crates/state has 190 #[test] items inline, but no crates/state/tests/ integration directory. In-module tests use in-memory doubles and cannot detect serialization drift, schema-migration bugs, or partial-write recovery. The absence of tests/ also means the public API of willow-state is never exercised against the real storage backend, nor across restart() boundaries.

There is no end-to-end "state + storage survives crash" test anywhere in the workspace.

Fix

Add crates/state/tests/persistence.rs driving the public API against the real storage backend:

  • Normal write → reopen → read round-trip.
  • Mid-write kill (use tempfile + crash-simulating writer) → reopen → re-apply pending events.
  • Schema migration bump scenarios.

Obvious? Moderate — the setup is mechanical but writing the crash-simulator takes care.

Metadata

Metadata

Assignees

No one assigned

    Projects

    No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions