Your browser sucks, JavaScript disabled! Gunnar's console needs JavaScript and WebAssembly. Git over SSH on port 2222 does not.

nordisk/holger

jobs/runner/tests/heimdall_from_crates_io.rs

//! **The job API is Heimdall's own crate from crates.io** (lane HOL-SANDBOX-TRAIT, 2026-10-31):
//! `nordisk-heimdall-core` (0.2 since lane HOL-HEIMDALL-02: the signed wire v2), published and SLSA-attested by the Heimdall project, named
//! `heimdall-core` in code. No vendored copy and no git or path edge to Heimdall's code stays
//! in Holger, so every Holger crate stays publishable and every build keyless.

use std::path::Path;

fn root() -> &'static Path {
    Path::new(concat!(env!("CARGO_MANIFEST_DIR"), "/../.."))
}

#[test]
fn the_job_api_comes_from_crates_io_and_no_copy_is_left() {
    let lock: toml::Table = std::fs::read_to_string(root().join("Cargo.lock"))
        .unwrap()
        .parse()
        .unwrap();
    let pkgs = lock["package"].as_array().unwrap();
    let core: Vec<&toml::Value> = pkgs
        .iter()
        .filter(|p| p["name"].as_str() == Some("nordisk-heimdall-core"))
        .collect();
    assert_eq!(core.len(), 1, "one nordisk-heimdall-core in the lock");
    assert_eq!(
        core[0]["source"].as_str(),
        Some("registry+https://github.com/rust-lang/crates.io-index"),
        "from crates.io"
    );
    assert!(
        core[0]["version"].as_str().unwrap().starts_with("0.2."),
        "{:?}",
        core[0]["version"]
    );
    for gone in ["holger-heimdall-core", "heimdall-core", "holger-jobs-core"] {
        assert!(
            !pkgs.iter().any(|p| p["name"].as_str() == Some(gone)),
            "{gone} is still in the lock"
        );
    }
    assert!(
        !root().join("jobs/heimdall-core").exists(),
        "the vendored copy is gone"
    );
    let runner: toml::Table = std::fs::read_to_string(root().join("jobs/runner/Cargo.toml"))
        .unwrap()
        .parse()
        .unwrap();
    let edge = &runner["dependencies"]["heimdall-core"];
    assert_eq!(edge["package"].as_str(), Some("nordisk-heimdall-core"));
    assert!(
        edge.get("path").is_none() && edge.get("git").is_none(),
        "{edge}"
    );
}