server/lib/tests/the_lock_links_one_rotaryengine.rs
//! stinky 16/28: the house engine is linked ONCE.
//!
//! `rotaryengine` (the library `gatling`) came into `Cargo.lock` twice: by path
//! through holger-server-lib and draupnir, and from crates.io through jera,
//! znippy-zoomies and the published draupnir. Two copies of one engine is two
//! worker pools that cannot see each other. This reads the workspace lock and
//! counts the `[[package]]` entries named `rotaryengine`.
#[test]
fn the_lock_links_rotaryengine_exactly_once_and_from_the_registry() {
let lock = std::fs::read_to_string(concat!(env!("CARGO_MANIFEST_DIR"), "/../../Cargo.lock"))
.expect("the workspace Cargo.lock is readable");
let entries: Vec<&str> = lock
.split("[[package]]")
.filter(|p| p.lines().any(|l| l.trim() == "name = \"rotaryengine\""))
.collect();
assert_eq!(
entries.len(),
1,
"rotaryengine is in the lock {} times: {entries:#?}",
entries.len()
);
assert!(
entries[0].contains("source = \"registry+https://github.com/rust-lang/crates.io-index\""),
"the one rotaryengine is the crates.io copy, never a path: {}",
entries[0]
);
}