xtask/tests/toolchain_pin.rs
//! **Holger's xtask names the declared toolchain, and never moves `:live`** (gate lane,
//! 2026-10-25: holger-ui switched in 3e89bb5; Holger's `cargo_road` still minted into
//! `nordisk-cargo-toolchain:live`).
//!
//! Step 1 of the cargo road goes through `ensure_declared_toolchain`: the pin present, nothing
//! is minted; absent, the shared recipe is minted under its own `:recipe-…` tag and the pin must
//! resolve afterwards. A `:live` re-mint un-names whatever image the tag held, and a pin on that
//! image then goes to a registry that does not exist.
/// The declared pin, the digest edda's shared recipe mints (gunnar-ui, holger-ui, dwarves and
/// edda pin the same).
const PIN: &str = "86d575e874677da3eb9aff3ba6e38ca600781ee9b7948a9df43ef89a6213c762";
#[test]
fn holger_declares_the_shared_recipe_digest() {
let variants = include_str!("../../.nornir/build-variants.toml");
let table = variants
.split("[build.toolchain]")
.nth(1)
.expect("holger declares [build.toolchain]");
assert!(
table.contains(&format!("image_sha256 = \"{PIN}\"")),
"the declared pin is {PIN}"
);
}
#[test]
fn holger_xtask_names_the_declared_toolchain_and_never_moves_live() {
let main = include_str!("../src/main.rs");
let road = main
.split("fn cargo_road(")
.nth(1)
.expect("xtask has a cargo_road");
let road = road.split("\nfn ").next().unwrap();
assert!(
road.contains("ensure_declared_toolchain("),
"step 1 reaches the pin through ensure_declared_toolchain"
);
assert!(
road.contains("tc.image_ref()"),
"the road names the declared pin"
);
assert!(
!road.contains("build_toolchain_image("),
"the road never mints into a floating tag"
);
assert!(
!road.contains(":live\""),
"the road never writes a `…:live` tag"
);
}