diff options
Diffstat (limited to 'tests/crash.rs')
| -rw-r--r-- | tests/crash.rs | 24 |
1 files changed, 7 insertions, 17 deletions
diff --git a/tests/crash.rs b/tests/crash.rs index e1f856f..68cac5c 100644 --- a/tests/crash.rs +++ b/tests/crash.rs @@ -1,11 +1,3 @@ -//! Crash, cancellation and the failure UI (§8.2, §8.4, I5). -//! -//! The difference between this file and the in-process fault hooks elsewhere is -//! that here the process actually dies. A shim sends `SIGKILL` to its parent in -//! the middle of the build step: no `Drop`, no unwinding, no chance to clean up. -//! That is the only way to prove the checkpoint story, because every in-process -//! simulation of a crash can be caught and tidied by accident. - mod common; use std::os::unix::process::ExitStatusExt; @@ -78,8 +70,8 @@ fn a_process_killed_mid_step_resumes_from_its_checkpoints_with_no_duplicate_work ); assert!(db::accepted_release(&env.db, "plain-make").unwrap().is_none(), "nothing was published"); - // Time passes; the lease expires. A fresh process's dispatcher reaps it — - // the same code path as any other expired lease, with no special recovery. + // Time passes; the lease expires. A fresh process's dispatcher reaps it — the + // same code path as any other expired lease. env.exec("UPDATE build SET lease_expires_at='2000-01-01T00:00:00Z' WHERE id=?1", ¶ms(vec![id.as_str()])); assert_eq!(builds::reap_expired(&env.db).unwrap(), 1); assert_eq!( @@ -87,8 +79,7 @@ fn a_process_killed_mid_step_resumes_from_its_checkpoints_with_no_duplicate_work Some(StepState::Interrupted) ); - // Resume. The completed steps are not repeated; only the interrupted one and - // what follows run. + // Resume: the completed steps are not repeated. env.cfg.hooks.shim_kill_parent = None; env.cfg.save().unwrap(); let out = run_cli(&env, &["run", &id]); @@ -117,8 +108,8 @@ fn a_process_killed_mid_step_resumes_from_its_checkpoints_with_no_duplicate_work #[test] fn a_cancelled_build_stops_at_a_step_boundary_and_publishes_nothing() { - // §8.2: cancellation is cooperative at a step boundary. A worker never kills - // a step halfway through, because that is exactly the state a crash leaves. + // §8.2: cancellation is cooperative at a step boundary. A worker never kills a + // step halfway through, because that is the state a crash leaves. let (env, _fx) = env_with_fixture("plain-make"); let id = queued(&env, "plain-make"); builds::request_cancel(&env.db, &id).unwrap(); @@ -137,7 +128,7 @@ fn a_cancelled_build_stops_at_a_step_boundary_and_publishes_nothing() { fn a_failed_build_leaves_the_index_serving_the_old_version_and_says_so() { // §8.4: "v2 approved, build failed, index still serving v1". The dangerous // failure mode is a package that looks healthy while the new version never - // arrived, so the state has to be visible, not inferable. + // arrived. let (mut env, fx) = env_with_fixture("plain-make"); // Publish v1 for real. let c = approved(&env, "plain-make"); @@ -153,8 +144,7 @@ fn a_failed_build_leaves_the_index_serving_the_old_version_and_says_so() { let out = pipeline::run(&env.cfg, &env.db, &id2).unwrap(); assert!(matches!(out, pipeline::Outcome::Failed { .. }), "{out:?}"); - // The index still serves v1 — that is correct — and the system knows the - // approved v2 never landed. + // The index still serves v1 — correct — and the system knows v2 never landed. assert_eq!(db::index_version(&env.db, "plain-make").unwrap().as_deref(), Some("1.0-1")); let unbuilt = db::approved_but_unbuilt(&env.db).unwrap(); assert_eq!(unbuilt.len(), 1, "the failed approval must be surfaced: {unbuilt:?}"); |
