summaryrefslogtreecommitdiffstats
path: root/tests/invariants.rs
diff options
context:
space:
mode:
authoraur-build <aur-build@localhost>2026-11-18 17:16:23 +0000
committeraur-build <aur-build@localhost>2026-11-18 17:16:23 +0000
commit8bb76cb266a2fef5d5fe43c0f9643101f59112aa (patch)
treeef421aa194b3cac2ab9e2662fcf41ce551260138 /tests/invariants.rs
parente7922f3dd1d985dcb993b624146b2492183f3a11 (diff)
downloadaur-build-8bb76cb266a2fef5d5fe43c0f9643101f59112aa.tar.gz
aur-build-8bb76cb266a2fef5d5fe43c0f9643101f59112aa.zip
config: the test hooks are a gated submodule, not the production surface
Seven fields sat on `Config` next to `signing_key_id` and `bind`: a PATH override, three shim protocol variables, a fault-injection point in the middle of `publish()`, and two more shims could obey. m-9's complaint was not that they exist — the shims are how I4, I5 and I9 are tested for real, and a mock would have asserted the mock's own behaviour — but that nothing said which of these was production and which was scaffolding, and the publish path carried a test branch on every real publish. They are one `TestHooks` submodule now, documented as what it is, and the whole submodule is `#[cfg(feature = "test-support")]` — the same feature that already gates the shims and the raw SQL escape hatch, and which only this crate's own dev-dependency turns on. A production build has no `hooks` field, no shim protocol in `child_env`, and no fault-injection branch in `publish()`; the serialized config skips the section entirely when nothing is hooked, so a real `config.json` never mentions any of it. `TestHooks::is_empty()` names the state a real process runs in, and three tests hold the line: the hook fields may be declared exactly once and only inside `TestHooks`, every `publish_fault` read in `publish.rs` must sit behind the feature gate, and a default config serializes without a trace of hooks.
Diffstat (limited to 'tests/invariants.rs')
-rw-r--r--tests/invariants.rs6
1 files changed, 3 insertions, 3 deletions
diff --git a/tests/invariants.rs b/tests/invariants.rs
index b7bfc0d..8026a79 100644
--- a/tests/invariants.rs
+++ b/tests/invariants.rs
@@ -158,7 +158,7 @@ fn i5_resume_after_a_crash_repeats_no_completed_step() {
pipeline::run(&env.cfg, &env.db, &id).unwrap(),
pipeline::Outcome::Failed { .. }
));
- let shim = env.cfg.shim_dir.clone().unwrap();
+ let shim = env.cfg.hooks.shim_dir.clone().unwrap();
let builds_before = aur_build::shims::called_with(&shim, "makechrootpkg", "");
assert_eq!(builds_before, 2, "one build per attempted publish");
@@ -422,10 +422,10 @@ fn i9_a_build_cannot_smuggle_bytes_in_from_outside_its_own_staging_dir() {
// Something a build must never get to publish: our own database file.
let secret = env.cfg.db_path();
let store_before = dir_listing(&env.cfg.store_dir());
- env.cfg.shim_plant_link = Some(secret.display().to_string());
+ env.cfg.hooks.shim_plant_link = Some(secret.display().to_string());
let out = pipeline::run(&env.cfg, &env.db, &id);
- env.cfg.shim_plant_link = None;
+ env.cfg.hooks.shim_plant_link = None;
let (step, err) = match out {
Ok(pipeline::Outcome::Failed { step, error, .. }) => (step, error),
other => panic!("a build that smuggled in a symlink must fail closed, got {other:?}"),