crates/monetize-server/src/estate_order/tests/seeds_off.rs
//! ★ **A32-28 (check: REAL): the seeds stop being served the moment the boxes pair.** A laid
//! machine's UpCloud `user_data` IS its pairing seed — the bootstrap private key and the shared
//! WireGuard `vm_private` key (monetize-shop-pairing `mint_material_for`) — and the metadata
//! service answers it to every process on the VM. The box reads it once, on its first boot,
//! before it pairs; after PAIRED nothing needs it. It was turned off only at the hand-off (after
//! the main reported, the sale check and the ready mail) — and never while an estate stayed
//! PAIRED (a main that does not report). Now each laid machine's metadata goes off at PAIRED.
use super::*;
#[test]
fn every_laid_machines_metadata_is_off_once_the_estate_is_paired() {
let r = rig_with("seeds-off", cfg(), "PASS");
// Its boxes never call home: the estate stays PAIRED (no report, no hand-off).
r.kit.silent.store(true, Ordering::SeqCst);
start_for(
&r.state,
"acme",
"buyer@example.org",
"",
"alice",
&EstateSizes::default(),
)
.unwrap();
r.pay.authorize(&handle_of(&r, "acme"));
drive(&r.state, "acme");
let run = r.state.estates.get("acme").unwrap();
assert_eq!(run.phase, phase::PAIRED, "{:#?}", run.history);
let servers: std::collections::BTreeSet<String> = run
.laid
.as_ref()
.unwrap()
.machines
.iter()
.map(|m| m.server.clone())
.collect();
let off: std::collections::BTreeSet<String> = r.cloud.metadata_off().into_iter().collect();
assert_eq!(
off, servers,
"no laid machine serves its seed once paired: {:#?}",
run.history
);
}