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

nordisk/nornir

crates/mimir-ingest/tests/estate_siblings.rs

//! A repo that loads its sibling patches through an untracked, optional
//! `.cargo/siblings.toml` (holger: `include = [{ path = "siblings.toml",
//! optional = true }]`) ships the content as `.cargo/estate-siblings.toml` and
//! a developer runs `cargo xtask siblings` to seat it. The consumer's clone has
//! nobody to run that, so without the seat the member does not load
//! ("no matching package named `appliance-grow`", oden 2026-10-23).

use mimir_ingest::checkout::seat_estate_siblings;

#[test]
fn a_shipped_estate_siblings_file_is_seated_as_siblings_toml() {
    let d = tempfile::tempdir().unwrap();
    let cargo = d.path().join(".cargo");
    std::fs::create_dir_all(&cargo).unwrap();
    std::fs::write(cargo.join("estate-siblings.toml"), "[patch.crates-io]\njera = { path = \"../edda/crates/jera\" }\n").unwrap();

    assert!(seat_estate_siblings(d.path()).unwrap(), "first call seats it");
    assert_eq!(
        std::fs::read_to_string(cargo.join("siblings.toml")).unwrap(),
        std::fs::read_to_string(cargo.join("estate-siblings.toml")).unwrap()
    );
    assert!(!seat_estate_siblings(d.path()).unwrap(), "same content: nothing written");

    // a later commit changes the shipped file: the seat follows it
    std::fs::write(cargo.join("estate-siblings.toml"), "[patch.crates-io]\n").unwrap();
    assert!(seat_estate_siblings(d.path()).unwrap());
    assert_eq!(std::fs::read_to_string(cargo.join("siblings.toml")).unwrap(), "[patch.crates-io]\n");
}

#[test]
fn a_repo_without_the_file_is_left_alone() {
    let d = tempfile::tempdir().unwrap();
    assert!(!seat_estate_siblings(d.path()).unwrap());
    assert!(!d.path().join(".cargo").exists());
}