Skip to content

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

chore(tests): add tenant isolation test coverage

Steven Enamakela5bf53ff4341
diff --git a/crates/openhuman-core/src/core/runtime/tenant_tests.rs b/crates/openhuman-core/src/core/runtime/tenant_tests.rs
index 33dd41070d..033251d887 100644
--- a/crates/openhuman-core/src/core/runtime/tenant_tests.rs
+++ b/crates/openhuman-core/src/core/runtime/tenant_tests.rs
@@ -196,3 +196,11 @@ async fn profile_keys_drop_the_agent() {
"no profile: the bare id, embedded agents included"
);
}
+
+#[test]
+fn only_the_unprofiled_default_orchestrator_is_unscoped() {
+ assert!(!tenant(None, None).is_scoped());
+ assert!(tenant(Some("alice"), None).is_scoped());
+ assert!(tenant(None, Some("alpha")).is_scoped());
+ assert!(tenant(Some("alice"), Some("alpha")).is_scoped());
+}
diff --git a/crates/openhuman-core/src/security/approval/gate_tenant_tests.rs b/crates/openhuman-core/src/security/approval/gate_tenant_tests.rs
index 897e8cc6bd..e567fe23ab 100644
--- a/crates/openhuman-core/src/security/approval/gate_tenant_tests.rs
+++ b/crates/openhuman-core/src/security/approval/gate_tenant_tests.rs
@@ -64,8 +64,12 @@ fn park_as(
))
}
+/// The request `tenant` parked on `t-test`. Returns as soon as it is parked;
+/// the ceiling only turns a turn that never parks into a failure instead of a
+/// hang, and is far above any scheduling delay a loaded CI runner adds.
async fn parked_for(gate: &ApprovalGate, tenant: &Tenant) -> String {
- for _ in 0..200 {
+ let deadline = tokio::time::Instant::now() + Duration::from_secs(30);
+ while tokio::time::Instant::now() < deadline {
if let Some(request_id) = gate.pending_for_tenant_thread(tenant, "t-test") {
return request_id;
}