summaryrefslogtreecommitdiffstats
path: root/tests/staleness.rs
diff options
context:
space:
mode:
Diffstat (limited to 'tests/staleness.rs')
-rw-r--r--tests/staleness.rs18
1 files changed, 0 insertions, 18 deletions
diff --git a/tests/staleness.rs b/tests/staleness.rs
index cadfc69..b5a5ac1 100644
--- a/tests/staleness.rs
+++ b/tests/staleness.rs
@@ -38,7 +38,6 @@ 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" means there is nowhere for a stale answer to hide.
let cols: Vec<String> = env
.db
.read(|c| {
@@ -52,15 +51,12 @@ fn staleness_is_derived_on_read_and_nothing_stores_it() {
.unwrap();
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 it.
pipeline::publish::withdraw_package(&env.cfg, &env.db, "plain-make").unwrap();
let after = staleness::stale_rows(&env.db).unwrap();
assert!(
after.iter().any(|s| s.pkgbase == "dep-client" && s.kind == staleness::Kind::Missing),
"withdrawing the dependency should flip the answer to missing: {after:?}"
);
- // And nothing about dep-client was written to make that happen.
assert_eq!(
env.query_i64("SELECT count(*) FROM release WHERE pkgbase_id=(SELECT id FROM pkgbase WHERE name='dep-client')", &[]),
Some(1),
@@ -72,8 +68,6 @@ fn staleness_is_derived_on_read_and_nothing_stores_it() {
#[test]
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 (§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();
@@ -84,10 +78,8 @@ fn a_missing_dependency_blocks_the_build_and_names_the_blocker_everywhere() {
assert_eq!(b.state, BuildState::BlockedMissingDep);
let blocked_on: Vec<String> = serde_json::from_str(&b.blocked_on_json).unwrap();
assert_eq!(blocked_on, vec!["dep-partner".to_string()]);
- // Blocked is not failed: nothing went wrong with the build itself.
assert_eq!(env.query_i64("SELECT count(*) FROM build WHERE state='failed'", &[]), Some(0));
- // It shows on Attention with the blocker named, not just "something is wrong".
let web = Web::attach(env, fx);
let page = web.get("/attention");
assert!(page.body.contains("Blocked builds"), "no blocked section: {}", &page.body[..600.min(page.body.len())]);
@@ -104,23 +96,18 @@ fn a_blocked_build_waits_and_is_requeued_only_when_the_blocker_arrives() {
pipeline::run(&env.cfg, &env.db, &id).unwrap();
assert_eq!(builds::get(&env.db, &id).unwrap().unwrap().state, BuildState::BlockedMissingDep);
- // The dispatcher sweeps blocked builds every pass. Requeueing one that will
- // immediately block again is a busy loop, so it must stay put.
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 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.
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");
- // And it now runs to completion.
pipeline::run(&env.cfg, &env.db, &id).unwrap();
assert_eq!(builds::get(&env.db, &id).unwrap().unwrap().state, BuildState::Succeeded);
assert!(aur_build::db::index_version(&env.db, "missing-dep").unwrap().is_some());
@@ -141,7 +128,6 @@ 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".
let (env, plain, _client) = env_with_two_fixtures("plain-make", "dep-client");
publish(&env, "plain-make");
publish(&env, "dep-client");
@@ -159,9 +145,7 @@ fn the_review_page_answers_what_approving_this_would_disturb() {
);
assert!(page.body.contains("dep-client"), "the dependent is not named");
- // And the same answer is available without the UI.
assert_eq!(staleness::dependents_of(&web.env.db, "plain-make").unwrap(), vec!["dep-client".to_string()]);
- // Approving it does not rebuild anything by itself (§10: no rebuild engine).
assert_eq!(web.env.query_i64("SELECT count(*) FROM build", &[]), Some(2), "one build per published package");
}
@@ -170,8 +154,6 @@ 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 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();