Skip to content

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

test(profiles): simplify cron cap test setup and add agent add helper

Steven Enamakel5d84ed191b11
diff --git a/crates/openhuman-core/src/profiles/host_cron_cap_tests.rs b/crates/openhuman-core/src/profiles/host_cron_cap_tests.rs
index 345743a145..e32b9e3ff4 100644
--- a/crates/openhuman-core/src/profiles/host_cron_cap_tests.rs
+++ b/crates/openhuman-core/src/profiles/host_cron_cap_tests.rs
@@ -3,17 +3,11 @@ use super::*;
#[tokio::test]
async fn the_operators_cron_limits_bind_every_profile_whatever_its_config_says() {
let tmp = tempfile::tempdir().unwrap();
- let fixture = sqlite_backend().unwrap();
let mut saas = SaasConfig::new(tmp.path());
saas.cron.agent_jobs_only = true;
saas.cron.min_interval_secs = 900;
saas.cron.max_active_jobs = 3;
- let host = ProfileHost::with_backend(
- saas,
- CoreContext::for_test(DomainSet::full(), None),
- Some(Arc::clone(&fixture.backend)),
- )
- .unwrap();
+ let host = ProfileHost::new(saas, CoreContext::for_test(DomainSet::full(), None));
let id = profile("alice");
host.provision(&id).await.unwrap();
// The user's own file tries to switch the mode off.
diff --git a/crates/openhuman-core/src/profiles/host_tests.rs b/crates/openhuman-core/src/profiles/host_tests.rs
index 003d83e2b0..1aad02c3c8 100644
--- a/crates/openhuman-core/src/profiles/host_tests.rs
+++ b/crates/openhuman-core/src/profiles/host_tests.rs
@@ -252,6 +252,15 @@ fn profile(name: &str) -> ProfileId {
ProfileId::for_user(name, crate::profiles::ProfileIdMode::Raw).unwrap()
}
+fn raw_profile_agent_add() -> tinyflows_bus::schedule::StoreOperation {
+ tinyflows_bus::schedule::StoreOperation::AddAgent {
+ spec: tinyflows_bus::schedule::AgentJobSpec::new(
+ tinyflows_bus::schedule::Schedule::Every { every_ms: 600_000 },
+ "profile quota transition probe",
+ ),
+ }
+}
+
struct RestoreInstalledStorage(Option<Arc<dyn crate::storage::StorageBackend>>);
impl Drop for RestoreInstalledStorage {