[control] Tests first: CLI token races, unsaved pause keeps the journal, lost share records never lower the epoch or shrink the deny list (red)
This commit is contained in:
@@ -257,6 +257,7 @@ caddy_credentials_dir = "{creds}"
|
||||
fn command(&self) -> Command {
|
||||
let mut c = Command::new(env!("CARGO_BIN_EXE_ianitor-control"));
|
||||
c.env_remove("IANITOR_TEST_CRASH_AT");
|
||||
c.env_remove("IANITOR_TEST_FAIL_WRITE");
|
||||
c
|
||||
}
|
||||
|
||||
@@ -329,6 +330,11 @@ caddy_credentials_dir = "{creds}"
|
||||
|
||||
/// Start the control binary; with `crash_at`, it aborts when an apply reaches that stage.
|
||||
pub fn start_control(&mut self, crash_at: Option<&str>) {
|
||||
self.start_control_env(crash_at, &[]);
|
||||
}
|
||||
|
||||
/// Like [`Env::start_control`], with extra environment (fault injection).
|
||||
pub fn start_control_env(&mut self, crash_at: Option<&str>, envs: &[(&str, &str)]) {
|
||||
self.log_n += 1;
|
||||
let log = std::fs::File::create(self.dir.join(&format!("logs/control-{}.log", self.log_n)))
|
||||
.unwrap();
|
||||
@@ -338,6 +344,9 @@ caddy_credentials_dir = "{creds}"
|
||||
if let Some(stage) = crash_at {
|
||||
c.env("IANITOR_TEST_CRASH_AT", stage);
|
||||
}
|
||||
for (k, v) in envs {
|
||||
c.env(k, v);
|
||||
}
|
||||
c.stdout(Stdio::from(log.try_clone().unwrap()))
|
||||
.stderr(Stdio::from(log));
|
||||
self.control = Some(ChildGuard(c.spawn().unwrap()));
|
||||
|
||||
Reference in New Issue
Block a user