Skip to content

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

test(profiles): move backend cron cap test into storage tests

Steven Enamakel0bcd5d6463d5
diff --git a/crates/openhuman-core/src/profiles/host.rs b/crates/openhuman-core/src/profiles/host.rs
index 17c42d5c94..e33254c67b 100644
--- a/crates/openhuman-core/src/profiles/host.rs
+++ b/crates/openhuman-core/src/profiles/host.rs
@@ -766,3 +766,7 @@ pub(super) fn unix_now() -> u64 {
#[cfg(test)]
#[path = "host_tests.rs"]
mod tests;
+
+#[cfg(test)]
+#[path = "host_storage_tests.rs"]
+mod storage_tests;
diff --git a/crates/openhuman-core/src/profiles/host_tests.rs b/crates/openhuman-core/src/profiles/host_tests.rs
index 830b8fbb56..b81c4a83dd 100644
--- a/crates/openhuman-core/src/profiles/host_tests.rs
+++ b/crates/openhuman-core/src/profiles/host_tests.rs
@@ -470,48 +470,6 @@ 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();