Merge pull request 'test(daemon): add default_agent_args unit tests for pi/zot harness' (#200) from feat/pi-autospawn-tests into main
Some checks are pending
CI / rust (push) Waiting to run
CI / markdown (push) Waiting to run
CI / port (push) Waiting to run
CI / agent-jail-pkgs (push) Waiting to run

Reviewed-on: #200
This commit is contained in:
clawdie 2026-06-25 23:52:51 +02:00
commit 5578de0abb

View file

@ -1360,4 +1360,39 @@ mod tests {
assert!(path.exists(), "live socket must not be removed");
let _ = std::fs::remove_dir_all(&dir);
}
#[test]
fn default_agent_args_zot_gets_rpc() {
assert_eq!(super::default_agent_args("zot"), vec!["rpc"]);
assert_eq!(
super::default_agent_args("/usr/local/bin/zot"),
vec!["rpc"],
"basename extraction must work for path-prefixed zot"
);
}
#[test]
fn default_agent_args_pi_gets_mode_json() {
assert_eq!(super::default_agent_args("pi"), vec!["--mode", "json"]);
assert_eq!(
super::default_agent_args("/usr/local/bin/pi"),
vec!["--mode", "json"],
"basename extraction must work for path-prefixed pi"
);
}
#[test]
fn default_agent_args_unknown_gets_mode_json() {
// Any binary that isn't zot gets the self-driving JSON mode.
// This is the safe default — unknown harnesses are assumed to be
// pi-compatible (--mode json), not zot-compatible (rpc).
assert_eq!(
super::default_agent_args("sample-pi-agent.py"),
vec!["--mode", "json"]
);
assert_eq!(
super::default_agent_args("colibri-test-agent"),
vec!["--mode", "json"]
);
}
}