summaryrefslogtreecommitdiffstats
path: root/tests/production_surface.rs
diff options
context:
space:
mode:
Diffstat (limited to 'tests/production_surface.rs')
-rw-r--r--tests/production_surface.rs36
1 files changed, 8 insertions, 28 deletions
diff --git a/tests/production_surface.rs b/tests/production_surface.rs
index e978a2c..e4e1346 100644
--- a/tests/production_surface.rs
+++ b/tests/production_surface.rs
@@ -1,17 +1,3 @@
-//! The production surface cannot see the test scaffolding (§6 M-4, M-9).
-//!
-//! The shim harness is load-bearing: the whole step machine is tested by driving
-//! the real binaries with fakes for `makepkg`, `mkarchroot`, `gpg` and friends.
-//! That is fine. What is not fine is production code reaching into it — the
-//! publish path once read a package's name through the shim module's copy of the
-//! `.PKGINFO` parser, which meant the bytes we signed and the bytes the tests
-//! believed were parsed by two pieces of code that could drift apart.
-//!
-//! The compile-time half of this rule is real: `shims` is compiled out unless the
-//! `test-support` feature is on, and only this crate's own dev-dependency turns
-//! it on. This test covers the half the compiler cannot: a module in `src/`
-//! naming the scaffolding directly.
-
use std::path::{Path, PathBuf};
fn read(rel: &str) -> String {
@@ -64,9 +50,7 @@ fn no_production_module_references_the_shim_harness() {
#[test]
fn the_served_index_has_exactly_one_serialization_lock() {
// §6 M-5: two mutexes in `publish.rs`, each documented as *the* "one publish
- // per repo" guarantee, with `withdraw_package` taking only one of them, is
- // worse than either answer — a reader cannot tell whether the guarantee is
- // redundant or incomplete. There is one lock now, and this keeps it that way.
+ // per repo" guarantee, is worse than either answer. There is one lock now.
let src = std::fs::read_to_string(Path::new(env!("CARGO_MANIFEST_DIR")).join("src/pipeline/publish.rs"))
.expect("read publish.rs");
let mutexes = src
@@ -104,10 +88,8 @@ fn the_shim_binaries_are_test_only() {
#[test]
fn the_test_hooks_are_a_gated_submodule_not_config_fields() {
- // §6 M-9: fault injection in the publish hot path, shim environment
- // variables and clock pinning were part of the production API surface —
- // `Config` advertised `publish_fault` next to `signing_key_id`, and the
- // branch that reads it sat in the middle of every real publish.
+ // §6 M-9: fault injection in the publish hot path, shim environment variables
+ // and clock pinning were part of the production API surface.
let cfg_src = read("src/config.rs");
for field in [
"pub path_prepend",
@@ -131,8 +113,8 @@ fn the_test_hooks_are_a_gated_submodule_not_config_fields() {
#[test]
fn the_publish_hot_path_has_no_ungated_test_branch() {
- // The two fault-injection points in `publish()` are the ones that ran on
- // every real publish. Each must sit behind the feature gate.
+ // The two fault-injection points in `publish()` must sit behind the feature
+ // gate.
let src = read("src/pipeline/publish.rs");
let lines: Vec<&str> = src.lines().collect();
let mut gated = 0;
@@ -162,10 +144,8 @@ fn a_default_config_has_no_hooks_attached() {
#[test]
fn the_review_modules_do_not_keep_private_copies_of_the_rules() {
- // §6 m-2: `hosts` existed twice, verbatim, and the "did the executable part
- // of the recipe change" rule existed twice with *different* semantics — the
- // diff panel compared function header lines, the risk scorer compared the
- // bodies. One question, one answer, in the module that owns the subject.
+ // §6 m-2: `hosts` existed twice, verbatim, and the "did the executable part of
+ // the recipe change" rule existed twice with *different* semantics.
for (file, forbidden) in [
("src/review/diff.rs", ["fn hosts(", "fn body_changed("]),
("src/review/risk.rs", ["fn hosts(", "fn body_changed("]),
@@ -184,7 +164,7 @@ fn the_review_modules_do_not_keep_private_copies_of_the_rules() {
#[test]
fn audit_rows_are_built_by_the_constructors_not_by_hand() {
// §6 m-4: three review sites hand-built `AuditEntry` literals, each with its
- // own `detail` shape and its own spelling of `actor_kind`.
+ // own `detail` shape.
let src = read("src/review/approve.rs");
assert!(!src.contains("db::AuditEntry {"), "audit rows must be built by AuditEntry::human/system");
assert_eq!(src.matches("AuditEntry::human(").count(), 3, "approve, reject and withdraw");