summaryrefslogtreecommitdiffstats
path: root/tests/staleness.rs
diff options
context:
space:
mode:
Diffstat (limited to 'tests/staleness.rs')
-rw-r--r--tests/staleness.rs28
1 files changed, 8 insertions, 20 deletions
diff --git a/tests/staleness.rs b/tests/staleness.rs
index bebceb4..cadfc69 100644
--- a/tests/staleness.rs
+++ b/tests/staleness.rs
@@ -1,11 +1,3 @@
-//! Staleness, blocked builds and the dependents question (§10).
-//!
-//! The design's position is that staleness is a fact to be shown, not a state to
-//! be stored: there is no automatic rebuild engine, and no `stale` column, because
-//! a stored flag goes wrong the moment anything else is published and something
-//! else always is. These tests pin that down — including the part that is easy to
-//! fake, which is that the derivation is real and not a cached answer.
-
mod common;
use aur_build::db::{builds, model::*};
@@ -46,8 +38,7 @@ fn staleness_is_derived_on_read_and_nothing_stores_it() {
assert_eq!(stale[0].built_with, "1.0-1");
assert_eq!(stale[0].now, "2.0-1");
- // "Derived purely on read" has to mean there is nowhere for a stale answer to
- // hide. No column on any table stores it.
+ // "Derived purely on read" means there is nowhere for a stale answer to hide.
let cols: Vec<String> = env
.db
.read(|c| {
@@ -62,7 +53,7 @@ fn staleness_is_derived_on_read_and_nothing_stores_it() {
assert!(cols.is_empty(), "staleness must not be persisted anywhere: {cols:?}");
// The answer tracks the index, not any stored flag: withdrawing plain-make
- // changes what is true about dep-client without touching dep-client at all.
+ // changes what is true about dep-client without touching it.
pipeline::publish::withdraw_package(&env.cfg, &env.db, "plain-make").unwrap();
let after = staleness::stale_rows(&env.db).unwrap();
assert!(
@@ -82,7 +73,7 @@ fn staleness_is_derived_on_read_and_nothing_stores_it() {
fn a_missing_dependency_blocks_the_build_and_names_the_blocker_everywhere() {
let (env, fx, _partner) = env_with_two_fixtures("missing-dep", "dep-partner");
// dep-partner is a package we intend to publish but have not yet: the build
- // cannot run, and that is a fact to report rather than a failure to retry.
+ // cannot run, and that is a fact to report (§10.4).
let c = approved(&env, "missing-dep");
assert_eq!(c.missing_deps(), vec!["dep-partner".to_string()], "the review must warn before approving");
let id = pipeline::enqueue_for_candidate(&env.cfg, &env.db, &c).unwrap();
@@ -118,16 +109,14 @@ fn a_blocked_build_waits_and_is_requeued_only_when_the_blocker_arrives() {
assert_eq!(builds::requeue_blocked(&env.db).unwrap(), 0, "requeued while still blocked");
assert_eq!(builds::get(&env.db, &id).unwrap().unwrap().state, BuildState::BlockedMissingDep);
- // Publishing dep-partner is what unblocks it. A build that was blocked and
- // can now run is not a new decision — a human already approved it (§10).
+ // Publishing dep-partner is what unblocks it: a human already approved it.
publish(&env, "dep-partner");
assert!(
aur_build::db::our_package_names(&env.db).unwrap().contains("dep-partner"),
"dep-partner should be in the index now: {:?}",
aur_build::db::our_package_names(&env.db)
);
- // Publishing the blocker requeues what was waiting on it — the publish path
- // sweeps blocked builds itself, so an explicit call afterwards is a no-op.
+ // Publishing the blocker requeues what was waiting on it.
assert_eq!(builds::get(&env.db, &id).unwrap().unwrap().state, BuildState::Queued, "the blocker arrived and the build stayed blocked");
assert_eq!(builds::requeue_blocked(&env.db).unwrap(), 0, "nothing left to requeue");
@@ -152,8 +141,7 @@ fn the_review_page_warns_about_missing_deps_before_approval() {
#[test]
fn the_review_page_answers_what_approving_this_would_disturb() {
- // §10.3: "approving this marks N packages stale". A reviewer approving a
- // plain-make bump needs to know that dep-client is about to need a rebuild.
+ // §10.3: "approving this marks N packages stale".
let (env, plain, _client) = env_with_two_fixtures("plain-make", "dep-client");
publish(&env, "plain-make");
publish(&env, "dep-client");
@@ -182,8 +170,8 @@ fn a_dependency_we_stopped_publishing_shows_as_missing_not_outdated() {
let (env, _plain, client) = env_with_two_fixtures("plain-make", "dep-client");
publish(&env, "plain-make");
publish(&env, "dep-client");
- // Withdraw plain-make from the index: dep-client was built against it and now
- // depends on something we no longer serve.
+ // Withdraw plain-make from the index: dep-client now depends on something we
+ // no longer serve.
pipeline::publish::withdraw_package(&env.cfg, &env.db, "plain-make").unwrap();
let stale = staleness::stale_rows(&env.db).unwrap();