Skip to content

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

test(flows): convert validation tests to async tokio tests

Steven Enamakel7c16ff0c5af9
diff --git a/crates/openhuman-core/src/flows/ops_agent_binding_tests.rs b/crates/openhuman-core/src/flows/ops_agent_binding_tests.rs
index a69e23df55..f8cec281bc 100644
--- a/crates/openhuman-core/src/flows/ops_agent_binding_tests.rs
+++ b/crates/openhuman-core/src/flows/ops_agent_binding_tests.rs
@@ -108,9 +108,9 @@ async fn agent_ref_unknown_is_rejected() {
/// Pinned here rather than left to the vendor's own suite because the
/// `workflow_builder` agent can propose this shape, and the message a builder
/// sees on rejection is this host's contract with it.
-#[test]
-fn dynamic_agent_ref_is_rejected_during_structural_validation() {
- let err = validate_and_migrate_graph(json!({
+#[tokio::test]
+async fn dynamic_agent_ref_is_rejected_during_structural_validation() {
+ let err = validate_and_migrate_graph(&crate::core::runtime::DispatchCtx::ambient(), &Config::default(), json!({
"nodes": [
{ "id": "t", "kind": "trigger", "name": "Manual" },
{ "id": "a", "kind": "agent", "name": "Dynamic",
@@ -118,6 +118,7 @@ fn dynamic_agent_ref_is_rejected_during_structural_validation() {
],
"edges": [ { "from_node": "t", "to_node": "a" } ]
}))
+ .await
.expect_err("dynamic agent_ref must fail structural validation");
assert!(
err.contains("agent_ref") && err.contains("must be a literal"),
diff --git a/crates/openhuman-core/src/flows/ops_tests.rs b/crates/openhuman-core/src/flows/ops_tests.rs
index bd2f01726f..9c0b6db025 100644
--- a/crates/openhuman-core/src/flows/ops_tests.rs
+++ b/crates/openhuman-core/src/flows/ops_tests.rs
@@ -79,8 +79,8 @@ fn structurally_valid_graph(value: Value) -> WorkflowGraph {
graph
}
-#[test]
-fn flows_import_uses_the_tinyflows_authoring_module_in_a_cold_process() {
+#[tokio::test]
+async fn flows_import_uses_the_tinyflows_authoring_module_in_a_cold_process() {
const CHILD_ENV: &str = "OPENHUMAN_FLOWS_IMPORT_AUTHORING_CHILD";
if std::env::var_os(CHILD_ENV).is_none() {
let output = std::process::Command::new(std::env::current_exe().expect("test executable"))
@@ -126,6 +126,7 @@ fn flows_import_uses_the_tinyflows_authoring_module_in_a_cold_process() {
}),
Some("native".to_string()),
)
+ .await
.expect("valid native graph imports")
.value;
assert_eq!(result.graph.name, "constant import");