The fastest, cheapest, most efficient open-source agent harness. Run more than 500 agents on a $10 VPS.
Rust agent-orchestrationai-agentsai-assistantdesktopllmlocal-firstmcppersonal-aiprivacyrustsecond-braintauri
test(profiles): cover cron cap enforcement on a supplied backend
Steven Enamakel9e08b41e5b41
diff --git a/crates/openhuman-core/src/profiles/host_tests.rs b/crates/openhuman-core/src/profiles/host_tests.rsindex b81c4a83dd..830b8fbb56 100644--- a/crates/openhuman-core/src/profiles/host_tests.rs+++ b/crates/openhuman-core/src/profiles/host_tests.rs@@ -470,6 +470,48 @@ async fn provisioning_installs_the_cron_cap_in_the_profile_scope() {.contains("Failed to insert cron agent job"));}+#[tokio::test]+async fn a_backend_supplied_to_profile_host_owns_its_cron_cap() {+ let tmp = tempfile::tempdir().unwrap();+ let id = profile("cron-cap-shared-backend");+ let mut saas = SaasConfig::new(tmp.path());+ saas.cron.agent_jobs_only = true;+ saas.cron.max_active_jobs = 1;+ let backend: Arc<dyn crate::storage::StorageBackend> =+ Arc::new(crate::storage::MemoryStorage::new());+ let fences = Arc::new(crate::storage::fence::FenceRegistry::new(+ crate::profiles::lease::now_ms,+ ));+ let host = ProfileHost::with_backend(+ saas,+ CoreContext::for_test(DomainSet::full(), None),+ Some(Arc::clone(&backend)),+ )+ .unwrap()+ .with_fences(fences);+ host.provision(&id).await.unwrap();+ let config = host.provisioned_config(&id).await.unwrap();+ let scope = crate::cron::documents_port::DocScope::on_backend(+ &config,+ Arc::clone(&backend),+ crate::storage::scope_for_profile(id.as_str()),+ );++ crate::cron::client::store_in::<crate::cron::CronJob>(&config, &scope, raw_profile_agent_add())+ .await+ .unwrap();+ let second = crate::cron::client::store_in::<crate::cron::CronJob>(+ &config,+ &scope,+ raw_profile_agent_add(),+ )+ .await;+ let error = second.expect_err("the cap must be installed in the supplied backend");+ assert!(error+ .to_string()+ .contains("Failed to insert cron agent job"));+}+#[tokio::test]async fn opening_an_existing_profile_adopts_the_enforced_cron_cap() {let tmp = tempfile::tempdir().unwrap();