Skip to content

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

test: pass dispatch context to scope helpers in e2e tests

Steven Enamakel33067c287751
diff --git a/tests/storage_agent_scopes_e2e.rs b/tests/storage_agent_scopes_e2e.rs
index 6a1f8d6fab..cee0e93cd2 100644
--- a/tests/storage_agent_scopes_e2e.rs
+++ b/tests/storage_agent_scopes_e2e.rs
@@ -197,7 +197,7 @@ async fn two_agents_keep_cron_and_flows_apart(case: Case) {
assert!(job_names(&config).is_empty());
// Background visits see the agents' jobs under their own ids.
- let visited = for_each_scope("e2e", || async { job_names(&config) }).await;
+ let visited = for_each_scope(&openhuman_core::core::runtime::DispatchCtx::host_default(), "e2e", |_| async { job_names(&config) }).await;
assert!(
visited.contains(&(
Some("agent-alpha".to_string()),
@@ -268,7 +268,7 @@ async fn no_acting_agent_falls_back_to_the_local_scope(case: Case) {
// The operator's records are what the `local` visit of a background loop
// sees.
- let visited = for_each_scope("e2e", || async { job_names(&config) }).await;
+ let visited = for_each_scope(&openhuman_core::core::runtime::DispatchCtx::host_default(), "e2e", |_| async { job_names(&config) }).await;
assert!(
visited.contains(&(None, vec!["operator-job".to_string()])),
"{visited:?}"
diff --git a/tests/storage_scope_e2e.rs b/tests/storage_scope_e2e.rs
index ab60111740..20fbd285e0 100644
--- a/tests/storage_scope_e2e.rs
+++ b/tests/storage_scope_e2e.rs
@@ -79,7 +79,7 @@ async fn background_work_visits_every_agent_scope(case: Case) {
assert!(job_names(&config).is_empty());
// Visited through the live agent context …
- let live = for_each_scope("e2e", || async { job_names(&config) }).await;
+ let live = for_each_scope(&openhuman_core::core::runtime::DispatchCtx::host_default(), "e2e", |_| async { job_names(&config) }).await;
assert!(
live.contains(&(Some("agent-e2e".to_string()), vec!["agent-job".to_string()])),
"{live:?}"
@@ -87,17 +87,17 @@ async fn background_work_visits_every_agent_scope(case: Case) {
// An event naming only the job resolves to its owner, and handling it
// there sees the job.
- let job_id = within_agent(Some("agent-e2e"), async {
+ let job_id = within_agent(&openhuman_core::core::runtime::DispatchCtx::host_default(), Some("agent-e2e"), async {
cron::list_jobs(&config).unwrap()[0].id.clone()
})
.await
.expect("the live agent has a context");
- let owner = find_owner("e2e", || async {
+ let owner = find_owner(&openhuman_core::core::runtime::DispatchCtx::host_default(), "e2e", |_| async {
Ok(cron::get_job(&config, &job_id).is_ok())
})
.await;
assert_eq!(owner, Ok(Some(Some("agent-e2e".to_string()))));
- let missing = find_owner("e2e", || async {
+ let missing = find_owner(&openhuman_core::core::runtime::DispatchCtx::host_default(), "e2e", |_| async {
Ok(cron::get_job(&config, "nope").is_ok())
})
.await;
@@ -106,7 +106,7 @@ async fn background_work_visits_every_agent_scope(case: Case) {
// … and, once the agent is gone, through the id the backend recorded.
assert!(AgentContextRegistry::deregister("agent-e2e", &agent));
drop(agent);
- let recorded = for_each_scope("e2e", || async { job_names(&config) }).await;
+ let recorded = for_each_scope(&openhuman_core::core::runtime::DispatchCtx::host_default(), "e2e", |_| async { job_names(&config) }).await;
assert!(
recorded.contains(&(Some("agent-e2e".to_string()), vec!["agent-job".to_string()])),
"{recorded:?}"