Skip to content

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

test(cron): run trusted memory trigger test in an isolated child process

Steven Enamakele15cc3defa24
diff --git a/crates/openhuman-core/src/cron/bus_host_trusted_system_tests.rs b/crates/openhuman-core/src/cron/bus_host_trusted_system_tests.rs
index 0054312789..4d0d5ee4f7 100644
--- a/crates/openhuman-core/src/cron/bus_host_trusted_system_tests.rs
+++ b/crates/openhuman-core/src/cron/bus_host_trusted_system_tests.rs
@@ -41,6 +41,42 @@ async fn agent_only_host(config: &Config) -> (HostRegistration, tinybus::Proxy)
#[tokio::test]
async fn schedule_trigger_runs_an_internally_seeded_memory_job_in_agent_only_scope() {
+ const CHILD: &str = "OPENHUMAN_TRUSTED_MEMORY_TRIGGER_CHILD";
+ if std::env::var_os(CHILD).is_none() {
+ let output = std::process::Command::new(std::env::current_exe().unwrap())
+ .args([
+ "--exact",
+ "cron::bus_host::trusted_system_tests::schedule_trigger_runs_an_internally_seeded_memory_job_in_agent_only_scope",
+ "--nocapture",
+ ])
+ .env(CHILD, "1")
+ .output()
+ .unwrap();
+ let stdout = String::from_utf8_lossy(&output.stdout);
+ assert!(
+ output.status.success(),
+ "isolated trigger child failed:\n{stdout}\n{}",
+ String::from_utf8_lossy(&output.stderr)
+ );
+ assert!(
+ stdout.contains("running 1 test"),
+ "child selected no test: {stdout}"
+ );
+ assert!(
+ stdout.contains("test cron::bus_host::trusted_system_tests::schedule_trigger_runs_an_internally_seeded_memory_job_in_agent_only_scope"),
+ "expected child test did not run: {stdout}"
+ );
+ assert!(
+ stdout.contains("test result: ok. 1 passed"),
+ "child did not pass exactly one test: {stdout}"
+ );
+ return;
+ }
+
+ schedule_trigger_runs_trusted_memory_job_child().await;
+}
+
+async fn schedule_trigger_runs_trusted_memory_job_child() {
let tmp = TempDir::new().unwrap();
let mut config = config(&tmp);
crate::cron::system_jobs::ensure_memory_jobs(&config).unwrap();