diff options
Diffstat (limited to 'tests/invariants.rs')
| -rw-r--r-- | tests/invariants.rs | 23 |
1 files changed, 23 insertions, 0 deletions
diff --git a/tests/invariants.rs b/tests/invariants.rs index 8026a79..1f6f7f2 100644 --- a/tests/invariants.rs +++ b/tests/invariants.rs @@ -301,6 +301,29 @@ fn i6_manual_rebuild_publishes_the_same_version_without_a_new_approval() { ); } +/// n-5: a manual rebuild's identity used to be a hand-rolled +/// `format!("{commit}|{hash}|manual}")` — a second, incompatible format for the +/// same concept, with a delimiter that can occur inside the values. It is now +/// derived through the same canonical-JSON hash as every other identity, and +/// what the change must not disturb is the two properties the queue depends on. +#[test] +fn a_manual_rebuild_is_deterministic_and_its_own_build() { + let (env, _fx) = env_with_fixture("plain-make"); + full_run(&env, "plain-make"); + let original = env + .query_str("SELECT id FROM build ORDER BY rowid LIMIT 1", &[]) + .expect("the published build"); + let a = pipeline::enqueue_manual_rebuild(&env.cfg, &env.db, "plain-make").unwrap(); + let b = pipeline::enqueue_manual_rebuild(&env.cfg, &env.db, "plain-make").unwrap(); + assert_eq!(a, b, "clicking rebuild twice is one build, not two (§8.2)"); + assert_ne!(a, original, "a rebuild is a distinct build from the one that landed"); + assert_eq!( + count(&env, "SELECT count(*) FROM build"), + 2, + "the second call must not enqueue a third row" + ); +} + /// **I10 — the audit log is append-only**, and every consequential action is in it. #[test] fn i10_audit_is_append_only_and_records_the_decisions() { |
