Fault-injection tests: prove backups survive interruption and corruption #72
Reference in New Issue
Block a user
Delete Branch "%!s()"
Deleting a branch is permanent. Although the deleted branch may continue to exist for a short time before it actually gets removed, it CANNOT be undone in most cases. Continue?
vaultik is a backup tool, so the failure modes that matter are the ones
where the process dies partway through or the destination lies. None of
those are currently tested. README:411-424 already names this gap; this
issue makes it actionable.
The existing suite covers the happy path well (
internal/vaultik3,114 test LOC,
internal/database4,203) but every test assumes writessucceed and data comes back intact.
Scenarios to cover
blob. Assert: no partial blob is recorded as complete in the local
index; a retry produces a consistent state; no dangling reference
survives.
kill -9between manifest write anddb.zst.ageupload. This isthe dangerous window — the destination has blobs and a manifest but no
index. Assert the next run detects and repairs the state, and that
snapshot listandverifyboth report it honestly rather thancrashing or silently ignoring it.
fails loudly with an actionable error naming the blob, and never
writes corrupt data to the restore target.
partially-written file left in place presenting as complete.
verify --deepmust catch it.Definition of done
without excessive machinery, say so explicitly on this issue with the
reason rather than silently skipping it.
code paths at test time — a fault-injecting
Storerwrapper is thenatural fit given the
internal/storageinterface. That wrappershould be reusable for future tests.
index, what is at the destination, what the user is told), not merely
that an error was returned.
is the likely outcome for scenarios 1 and 2 — file it as its own issue
linked here, and mark the test
t.Skipwith the issue number ratherthan leaving a red suite or weakening the assertion.
adopted, they belong in the tagged set.
make checkgreen.Out of scope
At-scale restore verification (multi-GB, thousands of files) is real
pre-1.0 work but belongs in its own issue — it is a performance and
endurance concern, not a correctness-under-failure one.