test(store): backups against a hand, a bad disk or another program

Thirty-six tests over the backup code the weekly coverage floor found
unreached, each an error a person can hit (WB-backup-2, -4, -6, -7, -8,
-12, -13, -14, -17, -19, -20, -21):

- manifests misfiled or chained wrongly: a manifest copied under another
  number, delta links that break each rule of the chain, a manifest
  edited by hand (its check line remade) into every lie check_names and
  the proof refuse, a manifest dropped of its vault or its keys, a
  manifest grown past anything this program writes;
- pieces replaced: a piece moved to a later generation is taken when it
  hashes right and refused when it does not, a stored-file piece
  replaced by a folder is found by the proof's share and written again
  beside it, a sealed piece that is no piece (no magic, or nothing after
  the magic) is not opened and is made again;
- cuts of books that lie: a journal without its last line's end, one line
  longer than a chunk, lines the books do not count, a last line that is
  not the head, a folder of the books holding something no book keeps, a
  vault record set aside after one was written anew, books that change
  under a cut, a destination ahead whose journal is damaged;
- the bounds: a piece that keeps being damaged ends the backup in words
  after two repairs, a manifest number taken eight times ends in Busy, a
  proof mark that cannot be made costs only a proof again;
- the words for the rest: the access log backed up to its last whole
  line and begun again when it moves back, a key file that is not a key,
  a header edited by hand, a sealed set whose header is not downloaded,
  a set found by many roads with junk around it, holds_only_sealed for
  the settings, the local backup's byte-for-byte journal, drills that
  name a newest too damaged to date, books shorter than the newest
  backup, a folder renamed to another book's name, a step stopped while
  proving an older backup, a scratch folder in use, and the io seam that
  carries a stop through a callback without losing its words.

Co-Authored-By: GLM 5.3 <noreply@z.ai>
This commit is contained in:
swaitsandGLM 5.3 committed 2026-12-02 13:41:44 -07:00
1 parent cf68ffe125
commit acdcdd7bda
2 files changed
+1871

No files matched your search

+20
View File
@@ -277,3 +277,23 @@ fn a_destination_of_thousands_of_backups_stays_small_and_quick_to_read() {
assert_eq!(m.journal.segments.len() as u64, n); assert_eq!(m.journal.segments.len() as u64, n);
} }
} }
#[test]
fn a_backup_error_carried_through_an_io_error_keeps_its_words() {
use super::io::{carry, uncarry};
// A stop or a death has to cross an io callback to be told (the fill
// of a put, the read of a piece); the words it was given are the
// words that come back, so a stopped backup is said as stopped
// (WB-backup-9), and the disk's own error is told as the disk's own.
let carried = carry(super::BackupError::Cancelled("backing up".into()));
let words = carried.to_string();
assert!(words.contains("backing up was stopped"), "{words}");
assert_eq!(
uncarry(carried),
super::BackupError::Cancelled("backing up".into())
);
assert_eq!(
uncarry(std::io::Error::from(std::io::ErrorKind::NotFound)),
super::BackupError::Io(std::io::ErrorKind::NotFound)
);
}
File diff suppressed because it is too large. Load diff