summaryrefslogtreecommitdiffstats
path: root/tests/state_machine.rs
diff options
context:
space:
mode:
Diffstat (limited to 'tests/state_machine.rs')
-rw-r--r--tests/state_machine.rs24
1 files changed, 8 insertions, 16 deletions
diff --git a/tests/state_machine.rs b/tests/state_machine.rs
index ccfdc42..f355e8f 100644
--- a/tests/state_machine.rs
+++ b/tests/state_machine.rs
@@ -1,6 +1,9 @@
mod common;
-use aur_build::db::{builds, model::{BuildState, CandidateState, StepState}};
+use aur_build::db::{
+ builds,
+ model::{BuildState, CandidateState, StepState},
+};
use common::Env;
// What remains all moves real rows through real transitions against a
// database. The two tests that were only about the state enum — the column-text
@@ -124,16 +127,11 @@ fn candidate(env: &Env, state: &str) -> i64 {
}
fn resolve(env: &Env, id: i64, to: CandidateState) -> aur_build::error::Result<()> {
- env.db
- .writer
- .tx_for_tests(move |tx| aur_build::db::candidates::resolve_in(tx, id, to, "2026-01-01T00:00:00Z"))
+ env.db.writer.tx_for_tests(move |tx| aur_build::db::candidates::resolve_in(tx, id, to, "2026-01-01T00:00:00Z"))
}
fn candidate_state(env: &Env, id: i64) -> CandidateState {
- aur_build::db::candidates::by_id(&env.db, id)
- .unwrap()
- .expect("candidate")
- .state
+ aur_build::db::candidates::by_id(&env.db, id).unwrap().expect("candidate").state
}
#[test]
@@ -190,19 +188,13 @@ fn an_interrupted_step_resumes_and_a_blocked_step_waits() {
fn an_unnamed_state_in_any_row_is_an_error() {
let env = Env::new();
let cid = candidate(&env, "approved");
- env.exec(
- "UPDATE candidate SET state='reconsidered' WHERE id=?1",
- &[common::P::I(cid)],
- );
+ env.exec("UPDATE candidate SET state='reconsidered' WHERE id=?1", &[common::P::I(cid)]);
let err = aur_build::db::candidates::by_id(&env.db, cid).unwrap_err();
assert!(err.to_string().contains("candidate has a state outside"), "{err}");
let id = build(&env, "b1");
builds::begin_step(&env.db, &id, "build", 1).unwrap();
- env.exec(
- "UPDATE build_step SET status='maybe' WHERE build_id=?1 AND step='build'",
- &[common::P::S(id.clone())],
- );
+ env.exec("UPDATE build_step SET status='maybe' WHERE build_id=?1 AND step='build'", &[common::P::S(id.clone())]);
let err = builds::step_status(&env.db, &id, "build").unwrap_err();
assert!(err.to_string().contains("build step has a state outside"), "{err}");
}