[control] Store and recovery fixes: cross-process token lock, revert keeps its journal until done, epoch and deny list never roll back, journal errors propagate, lost confirm reloads edge, trial hash checked
This commit is contained in:
@@ -5,6 +5,9 @@
|
||||
//! Crash points for the crash-safety tests: with `IANITOR_TEST_CRASH_AT=<stage>` in its
|
||||
//! environment, control aborts (no cleanup, like a kill -9) when an apply reaches that stage.
|
||||
//! Without the variable this does nothing; the NixOS unit never sets it.
|
||||
//!
|
||||
//! `IANITOR_TEST_FAIL_WRITE=<file name>` makes every write of a state file with that name
|
||||
//! fail, as on a full disk (fault injection for the same tests).
|
||||
|
||||
/// The stages, in order.
|
||||
pub const STAGES: [&str; 9] = [
|
||||
@@ -25,3 +28,17 @@ pub fn point(stage: &str) {
|
||||
std::process::abort();
|
||||
}
|
||||
}
|
||||
|
||||
/// Fail a state-file write when `IANITOR_TEST_FAIL_WRITE` names this file.
|
||||
pub fn fail_write(path: &std::path::Path) -> Result<(), String> {
|
||||
match (
|
||||
std::env::var_os("IANITOR_TEST_FAIL_WRITE"),
|
||||
path.file_name(),
|
||||
) {
|
||||
(Some(want), Some(name)) if want == name => Err(format!(
|
||||
"cannot write {}: IANITOR_TEST_FAIL_WRITE (injected)",
|
||||
path.display()
|
||||
)),
|
||||
_ => Ok(()),
|
||||
}
|
||||
}
|
||||
|
||||
Reference in New Issue
Block a user