Skip to content

The fastest, cheapest, most efficient open-source agent harness. Run more than 500 agents on a $10 VPS.

style: reformat test assertions and calls to satisfy rustfmt

Steven Enamakel6eda4825b0b0
diff --git a/crates/openhuman-core/src/core/runtime/boot_guard_tests.rs b/crates/openhuman-core/src/core/runtime/boot_guard_tests.rs
index 1cde4ad187..1b6d1fa4e1 100644
--- a/crates/openhuman-core/src/core/runtime/boot_guard_tests.rs
+++ b/crates/openhuman-core/src/core/runtime/boot_guard_tests.rs
@@ -37,7 +37,10 @@ fn inputs<'a>(f: &'a Fixture, env: &'a [(String, String)]) -> BootInputs<'a> {
}
fn violations(inputs: &BootInputs<'_>) -> Vec<Violation> {
- check(inputs).err().map(|e| e.violations).unwrap_or_default()
+ check(inputs)
+ .err()
+ .map(|e| e.violations)
+ .unwrap_or_default()
}
fn env(pairs: &[(&str, &str)]) -> Vec<(String, String)> {
@@ -75,7 +78,10 @@ fn background_services_beyond_the_preset_are_refused() {
i.services = ServiceSet::desktop();
let found = violations(&i);
for name in ["socketio", "cron", "channels", "login_gated", "mcp_boot"] {
- assert!(found.contains(&Violation::Service(name)), "{name}: {found:?}");
+ assert!(
+ found.contains(&Violation::Service(name)),
+ "{name}: {found:?}"
+ );
}
assert!(!found.contains(&Violation::Service("rpc_http")));
}
@@ -87,7 +93,10 @@ fn domain_families_are_refused_until_they_are_isolated() {
i.domains = DomainSet::harness();
let found = violations(&i);
for name in ["agent", "memory", "threads", "config", "security"] {
- assert!(found.contains(&Violation::Domain(name)), "{name}: {found:?}");
+ assert!(
+ found.contains(&Violation::Domain(name)),
+ "{name}: {found:?}"
+ );
}
}
@@ -103,9 +112,7 @@ fn single_user_environment_is_refused() {
]);
let found = violations(&inputs(&f, &vars));
assert_eq!(found.len(), 5, "{found:?}");
- assert!(found
- .iter()
- .all(|v| matches!(v, Violation::Env { .. })));
+ assert!(found.iter().all(|v| matches!(v, Violation::Env { .. })));
}
#[test]
@@ -118,9 +125,15 @@ fn empty_values_do_not_count_as_set() {
#[test]
fn protections_may_be_switched_on_but_not_off() {
let f = fixture();
- let on = env(&[("OPENHUMAN_APPROVAL_GATE", "1"), ("OPENHUMAN_SANDBOX", "on")]);
+ let on = env(&[
+ ("OPENHUMAN_APPROVAL_GATE", "1"),
+ ("OPENHUMAN_SANDBOX", "on"),
+ ]);
assert_eq!(check(&inputs(&f, &on)), Ok(()));
- let off = env(&[("OPENHUMAN_APPROVAL_GATE", "0"), ("OPENHUMAN_SANDBOX", "off")]);
+ let off = env(&[
+ ("OPENHUMAN_APPROVAL_GATE", "0"),
+ ("OPENHUMAN_SANDBOX", "off"),
+ ]);
assert_eq!(violations(&inputs(&f, &off)).len(), 2);
}
@@ -147,10 +160,16 @@ fn allowlists_are_refused_until_their_isolation_ships() {
fn a_bad_root_is_refused() {
let mut f = fixture();
f.config.root = PathBuf::from("relative/root");
- assert!(matches!(violations(&inputs(&f, &[]))[..], [Violation::Root(_)]));
+ assert!(matches!(
+ violations(&inputs(&f, &[]))[..],
+ [Violation::Root(_)]
+ ));
f.config.root = PathBuf::from("/definitely/not/here/openhuman-saas");
- assert!(matches!(violations(&inputs(&f, &[]))[..], [Violation::Root(_)]));
+ assert!(matches!(
+ violations(&inputs(&f, &[]))[..],
+ [Violation::Root(_)]
+ ));
}
#[test]
@@ -214,7 +233,10 @@ fn service_token_file_rules() {
let tmp = tempfile::tempdir().unwrap();
let path = tmp.path().join("service.token");
- assert!(matches!(ServiceToken::read(&path), ServiceToken::Invalid(_)));
+ assert!(matches!(
+ ServiceToken::read(&path),
+ ServiceToken::Invalid(_)
+ ));
std::fs::write(&path, "short\n").unwrap();
#[cfg(unix)]
diff --git a/crates/openhuman-core/src/core/runtime/saas_tests.rs b/crates/openhuman-core/src/core/runtime/saas_tests.rs
index 792061a54b..10a7f936f9 100644
--- a/crates/openhuman-core/src/core/runtime/saas_tests.rs
+++ b/crates/openhuman-core/src/core/runtime/saas_tests.rs
@@ -48,7 +48,11 @@ fn unknown_keys_are_refused() {
// A misspelt safety setting must not be silently ignored.
let tmp = tempfile::tempdir().unwrap();
let path = tmp.path().join("operator.toml");
- std::fs::write(&path, "root = \"/srv/oh\"\ntool_allow_list = [\"coding\"]\n").unwrap();
+ std::fs::write(
+ &path,
+ "root = \"/srv/oh\"\ntool_allow_list = [\"coding\"]\n",
+ )
+ .unwrap();
let err = SaasConfig::load(&path).unwrap_err().to_string();
assert!(err.contains("tool_allow_list"), "{err}");
}
diff --git a/tests/saas_mode_e2e.rs b/tests/saas_mode_e2e.rs
index 5f1a1f3f69..79471107a6 100644
--- a/tests/saas_mode_e2e.rs
+++ b/tests/saas_mode_e2e.rs
@@ -42,7 +42,11 @@ fn deployment(write_token: bool) -> Deployment {
set_mode(&token, 0o600);
}
let config = tmp.path().join("operator.toml");
- std::fs::write(&config, format!("root = {:?}\n", root.display().to_string())).unwrap();
+ std::fs::write(
+ &config,
+ format!("root = {:?}\n", root.display().to_string()),
+ )
+ .unwrap();
Deployment { tmp, root, config }
}
@@ -116,7 +120,12 @@ fn free_port() -> u16 {
.port()
}
-fn rpc(client: &reqwest::blocking::Client, base: &str, bearer: Option<&str>, method: &str) -> (u16, Value) {
+fn rpc(
+ client: &reqwest::blocking::Client,
+ base: &str,
+ bearer: Option<&str>,
+ method: &str,
+) -> (u16, Value) {
let mut request = client.post(format!("{base}/rpc")).json(&json!({
"jsonrpc": "2.0",
"id": 1,
@@ -177,7 +186,10 @@ fn a_safe_deployment_serves_only_core_built_ins_behind_the_gateway_bearer() {
"openhuman.memory_search",
] {
let (_, body) = rpc(&client, &base, Some(BEARER), method);
- assert!(body.get("error").is_some(), "{method} must not be served: {body}");
+ assert!(
+ body.get("error").is_some(),
+ "{method} must not be served: {body}"
+ );
}
assert!(
@@ -185,7 +197,11 @@ fn a_safe_deployment_serves_only_core_built_ins_behind_the_gateway_bearer() {
"the operator plane lives under the SaaS root"
);
assert!(
- !d.tmp.path().join(".openhuman").join("active_user.toml").exists(),
+ !d.tmp
+ .path()
+ .join(".openhuman")
+ .join("active_user.toml")
+ .exists(),
"a SaaS boot never activates a desktop user"
);
drop(server);