summaryrefslogtreecommitdiffstats
path: root/tests/vcs.rs
diff options
context:
space:
mode:
Diffstat (limited to 'tests/vcs.rs')
-rw-r--r--tests/vcs.rs26
1 files changed, 0 insertions, 26 deletions
diff --git a/tests/vcs.rs b/tests/vcs.rs
index 62efe5f..e83643e 100644
--- a/tests/vcs.rs
+++ b/tests/vcs.rs
@@ -23,7 +23,6 @@ fn makepkg_calls(env: &Env) -> usize {
#[test]
fn stage_a_probes_every_vcs_source_not_just_the_first() {
let (env, fx) = env_with_fixture("git-multi");
- // Two upstream repos, two pins: either one can move alone (§5.2).
let (outcome, c) = detect_and_take(&env, "git-multi");
assert!(matches!(outcome, detect::Outcome::Candidate { .. }), "{outcome:?}");
let c = c.unwrap();
@@ -33,7 +32,6 @@ fn stage_a_probes_every_vcs_source_not_just_the_first() {
assert_eq!(pins[1].commit, fx.upstream2_head(), "second source pin");
assert_eq!(pins[0].index, 0);
assert_eq!(pins[1].index, 1);
- // The resolved version came from Stage B, not from the frozen pkgver= line.
assert_eq!(c.pkgver, "r1");
}
@@ -47,7 +45,6 @@ fn stage_a_respects_a_tag_pin() {
assert_eq!(pins[0].ref_, "v1", "the #tag=v1 fragment is the ref we asked for");
assert_eq!(pins[0].commit, head_at_tag, "the tag resolved to its commit");
- // Upstream moves; a tagged pin must not follow it.
fx.upstream_commit("upstream: moved past the tag\n");
let (outcome, _) = detect_and_take(&env, "git-tagged");
assert!(
@@ -66,8 +63,6 @@ fn stage_a_short_circuits_before_stage_b_when_nothing_moved() {
let id = aur_build::pipeline::enqueue_for_candidate(&env.cfg, &env.db, &c).unwrap();
aur_build::pipeline::run(&env.cfg, &env.db, &id).unwrap();
- // Now poll again with nothing changed. Stage A finds the same tip set, so Stage
- // B must not run at all — the common case, every day.
let before = makepkg_calls(&env);
let cache_before = stage_b_rows(&env);
let r = detect::check_pkgbase(&env.cfg, &env.db, "git-sourced").unwrap();
@@ -82,15 +77,10 @@ fn stage_b_resolves_pkgver_and_captures_the_pins() {
let head = fx.upstream_head();
let (_outcome, c) = detect_and_take(&env, "git-sourced");
let c = c.unwrap();
- // The candidate's version is what `pkgver()` computed, not the frozen field.
assert_eq!(c.pkgver, "r1.0");
assert_eq!(c.pkgrel, "1");
- // The pins it will be built from are recorded now, while the clone is already
- // there.
let pins: Vec<UpstreamPin> = serde_json::from_str(&c.upstream_pins_json).unwrap();
assert_eq!(pins[0].commit, head);
- // The pins are part of the identity: a different commit is a different thing to
- // approve.
let with_pins = Identity {
aur_commit: "x".into(),
epoch: "0".into(),
@@ -111,17 +101,13 @@ fn stage_b_is_cached_on_pkgbase_recipe_and_tip() {
let calls = makepkg_calls(&env);
assert!(calls >= 1, "Stage B must actually run once");
- // Same recipe, same tip: the cached answer is reused, no new resolution.
detect::check_pkgbase(&env.cfg, &env.db, "git-sourced").unwrap();
assert_eq!(makepkg_calls(&env), calls, "cache miss on an unchanged key");
assert_eq!(stage_b_rows(&env), 1);
- // A new tip is a new key, so it resolves again — but the cooldown window holds
- // it back.
fx.upstream_commit("upstream: new tip\n");
detect::check_pkgbase(&env.cfg, &env.db, "git-sourced").unwrap();
assert_eq!(stage_b_rows(&env), 1, "cooldown should suppress the re-resolve");
- // Outside the window it resolves again.
env.exec("UPDATE stage_b_cache SET resolved_at='2000-01-01T00:00:00Z'", &[]);
detect::check_pkgbase(&env.cfg, &env.db, "git-sourced").unwrap();
assert_eq!(stage_b_rows(&env), 2, "a new tip outside cooldown must resolve");
@@ -130,8 +116,6 @@ fn stage_b_is_cached_on_pkgbase_recipe_and_tip() {
#[test]
fn stage_b_concurrency_cap_is_enforced() {
- // The cap is a process-wide guard; with the default of 1 a second caller waits
- // for the first.
let (env, _fx) = env_with_fixture("git-sourced");
let slots = std::sync::Arc::new(std::sync::atomic::AtomicUsize::new(0));
let s1 = slots.clone();
@@ -154,8 +138,6 @@ fn stage_b_concurrency_cap_is_enforced() {
#[test]
fn an_unprobeable_source_forces_stage_b_instead_of_claiming_no_change() {
- // svn/hg have no cheap universal probe. The honest answer is "we do not know",
- // which means Stage B runs.
let recipe = aur_build::recipe::parse_pkgbuild(
&std::fs::read_to_string(corpus_root().join("git-sourced/PKGBUILD")).unwrap(),
)
@@ -178,8 +160,6 @@ fn an_unprobeable_source_forces_stage_b_instead_of_claiming_no_change() {
#[test]
fn a_moved_tip_with_an_unchanged_pkgver_is_a_notice_not_a_candidate() {
- // §5.2: pins moved, version frozen — pacman cannot offer an upgrade, so it
- // becomes a notice and is never dropped.
let (env, fx) = env_with_fixture("pin-drift");
let (_outcome, c) = detect_and_take(&env, "pin-drift");
let c = c.unwrap();
@@ -188,8 +168,6 @@ fn a_moved_tip_with_an_unchanged_pkgver_is_a_notice_not_a_candidate() {
let id = aur_build::pipeline::enqueue_for_candidate(&env.cfg, &env.db, &c).unwrap();
aur_build::pipeline::run(&env.cfg, &env.db, &id).unwrap();
- // Upstream moves. The shim still reports the same pkgver, as a degenerate
- // `pkgver()` does, so nothing is publishable.
fx.upstream_commit("upstream: 14 more commits\n");
env.exec("UPDATE stage_b_cache SET resolved_at='2000-01-01T00:00:00Z'", &[]);
let (outcome, new_candidate) = detect_and_take(&env, "pin-drift");
@@ -198,13 +176,11 @@ fn a_moved_tip_with_an_unchanged_pkgver_is_a_notice_not_a_candidate() {
other => panic!("expected a pin_drift notice, got {other:?}"),
}
assert!(new_candidate.is_none(), "a non-publishable change opens no review");
- // But it is recorded, and says why (§5.2 wording).
let notices = db::list_notices(&env.db, false).unwrap();
assert_eq!(notices.len(), 1);
assert_eq!(notices[0].kind, notice_kind::PIN_DRIFT);
let detail = notices[0].detail_json.clone();
assert!(detail.contains("nothing publishable"), "{detail}");
- // The index keeps serving the artifact built from the old pins (I11).
assert_eq!(
env.query_i64("SELECT count(*) FROM package WHERE state='in_index'", &[]),
Some(1)
@@ -223,7 +199,6 @@ fn a_moved_tip_with_a_changed_pkgver_is_a_normal_candidate() {
fx.upstream_commit("upstream: a real release\n");
env.exec("UPDATE stage_b_cache SET resolved_at='2000-01-01T00:00:00Z'", &[]);
- // The tool now computes a different version from the new tip.
let mut m = fx.manifest_json();
m["vercheck"] = serde_json::json!("r2.0-1");
std::fs::write(&fx.manifest, serde_json::to_string(&m).unwrap()).unwrap();
@@ -243,7 +218,6 @@ fn the_vcs_cache_is_reused_across_polls() {
let cache = env.cfg.vcs_cache_path(&format!("file://{}", fx.upstream.clone().unwrap().display()));
assert!(cache.exists(), "Stage B should leave a persistent clone behind (§5.2 clone reuse)");
let mtime_before = std::fs::metadata(&cache).ok().and_then(|m| m.modified().ok());
- // A second resolution reuses it rather than re-cloning.
env.exec("UPDATE stage_b_cache SET resolved_at='2000-01-01T00:00:00Z'", &[]);
fx.upstream_commit("upstream: again\n");
detect::check_pkgbase(&env.cfg, &env.db, "git-sourced").unwrap();