Watch
0
0
Fork
You've already forked hyperhive
0

deploy the closure the swarm declares, read no forge head, drop the update badge

This commit is contained in:
atlas 2026-11-01 23:56:40 +01:00 • committed by mara
commit 47c2acb640
2 changed files with 647 additions and 2001 deletions

View file

@ -687,16 +687,6 @@ pub async fn list() -> Result<Vec<String>> {
.collect())
}
/// Logical agent names from a [`list`] result. An unreadable list stays an
/// error rather than becoming "no agents": a caller fanning work out over
/// every agent would otherwise report success after doing nothing.
pub fn agent_names(listed: Result<Vec<String>>) -> Result<Vec<String>> {
Ok(listed?
.into_iter()
.filter_map(|c| c.strip_prefix(AGENT_PREFIX).map(str::to_owned))
.collect())
}
/// Ensure the per-agent runtime directory `/run/hyperhive/agents/<name>`
/// exists. It is a bind source and `/run` is a tmpfs, so every start path
/// creates it before `nixos-container start`.

View file

@ -180,21 +180,6 @@ fn failed_destroy_with_an_unreadable_list_fails() {
assert!(format!("{err:#}").contains("cannot confirm"), "{err:#}");
}
#[test]
fn agent_names_strips_the_container_prefix() {
let names = agent_names(Ok(vec![format!("{AGENT_PREFIX}iris"), "other".to_owned()]))
.expect("a readable list");
assert_eq!(names, vec!["iris"]);
}
/// A failed list is not an empty hive: the error reaches the caller.
#[test]
fn agent_names_propagates_an_unreadable_list() {
let err = agent_names(Err(anyhow::anyhow!("connect to hive-priv socket")))
.expect_err("an unreadable list must not read as zero agents");
assert!(format!("{err:#}").contains("hive-priv"), "{err:#}");
}
/// The setup path creates the agent's `work/` dir beside `state/`, so the
/// bind source exists before nspawn starts the container.
#[test]