summaryrefslogtreecommitdiffstats
path: root/tests/crash.rs
diff options
context:
space:
mode:
Diffstat (limited to 'tests/crash.rs')
-rw-r--r--tests/crash.rs14
1 files changed, 7 insertions, 7 deletions
diff --git a/tests/crash.rs b/tests/crash.rs
index 8d8ba35..0510aab 100644
--- a/tests/crash.rs
+++ b/tests/crash.rs
@@ -62,7 +62,7 @@ fn a_process_killed_mid_step_resumes_from_its_checkpoints_with_no_duplicate_work
// The database survived, because no transaction ever spans a build step.
let b = builds::get(&env.db, &id).unwrap().expect("build row survived the kill");
assert!(
- b.state == build_state::LEASED || b.state == build_state::RUNNING,
+ b.state == BuildState::Leased || b.state == BuildState::Running,
"a killed build must still look claimed, not finished: {}",
b.state
);
@@ -112,7 +112,7 @@ fn a_process_killed_mid_step_resumes_from_its_checkpoints_with_no_duplicate_work
"no duplicate release from the resume"
);
assert_eq!(db::index_version(&env.db, "plain-make").unwrap().as_deref(), Some("1.0-1"));
- assert_eq!(builds::get(&env.db, &id).unwrap().unwrap().state, build_state::SUCCEEDED);
+ assert_eq!(builds::get(&env.db, &id).unwrap().unwrap().state, BuildState::Succeeded);
}
#[test]
@@ -124,7 +124,7 @@ fn a_cancelled_build_stops_at_a_step_boundary_and_publishes_nothing() {
builds::request_cancel(&env.db, &id).unwrap();
let out = pipeline::run(&env.cfg, &env.db, &id).unwrap();
assert!(matches!(out, pipeline::Outcome::Cancelled), "{out:?}");
- assert_eq!(builds::get(&env.db, &id).unwrap().unwrap().state, build_state::CANCELLED);
+ assert_eq!(builds::get(&env.db, &id).unwrap().unwrap().state, BuildState::Cancelled);
// Nothing ran, so nothing to undo.
let shim = env.cfg.shim_dir.clone().unwrap();
assert_eq!(aur_build::shims::called_with(&shim, "repo-add", ""), 0);
@@ -179,18 +179,18 @@ fn a_transient_failure_retries_but_a_deterministic_one_never_does() {
let (mut env, _fx) = env_with_fixture("build-fails");
let id = queued(&env, "build-fails");
let pool = aur_build::pipeline::dispatch::Pool::spawn(std::sync::Arc::new(env.cfg.clone()), env.db.clone());
- let mut state = String::new();
+ let mut state = BuildState::Queued;
for _ in 0..400 {
if let Some(b) = builds::get(&env.db, &id).unwrap() {
- state = b.state.clone();
- if state == build_state::FAILED {
+ state = b.state;
+ if state == BuildState::Failed {
break;
}
}
std::thread::sleep(std::time::Duration::from_millis(25));
}
pool.shutdown();
- assert_eq!(state, build_state::FAILED);
+ assert_eq!(state, BuildState::Failed);
assert_eq!(builds::get(&env.db, &id).unwrap().unwrap().attempt, 1, "a deterministic failure must not retry");
// The release stays approved_but_unbuilt rather than vanishing.
assert_eq!(db::approved_but_unbuilt(&env.db).unwrap().len(), 1);