Skip to content

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

test(sandbox): add coverage for native jail, ops, and shell progress

Steven Enamakela3316b5fd722
diff --git a/crates/openhuman-core/src/sandbox/native_jail_tests.rs b/crates/openhuman-core/src/sandbox/native_jail_tests.rs
index 56d4771c4d..e8112c7478 100644
--- a/crates/openhuman-core/src/sandbox/native_jail_tests.rs
+++ b/crates/openhuman-core/src/sandbox/native_jail_tests.rs
@@ -101,6 +101,7 @@ async fn disabled_tinybox_module_never_falls_back_to_host_execution() -> anyhow:
&HashMap::new(),
Duration::from_secs(5),
false,
+ None,
)
.await;
@@ -212,6 +213,7 @@ async fn released_tinybox_runs_a_native_jail_through_the_pinned_loader() -> anyh
&HashMap::new(),
Duration::from_secs(10),
false,
+ None,
)
.await?;
assert!(output.success());
@@ -226,6 +228,7 @@ async fn released_tinybox_runs_a_native_jail_through_the_pinned_loader() -> anyh
&HashMap::new(),
Duration::from_secs(10),
false,
+ None,
)
.await?;
assert!(output.success());
diff --git a/crates/openhuman-core/src/sandbox/ops_tests.rs b/crates/openhuman-core/src/sandbox/ops_tests.rs
index 96d8ab054b..e225b222ce 100644
--- a/crates/openhuman-core/src/sandbox/ops_tests.rs
+++ b/crates/openhuman-core/src/sandbox/ops_tests.rs
@@ -125,6 +125,7 @@ async fn run_unsandboxed(
workspace,
env,
timeout,
+ None,
)
.await
}
diff --git a/crates/openhuman-core/src/sandbox/shell_progress_tests.rs b/crates/openhuman-core/src/sandbox/shell_progress_tests.rs
index ff73f8faa5..d06a75f44e 100644
--- a/crates/openhuman-core/src/sandbox/shell_progress_tests.rs
+++ b/crates/openhuman-core/src/sandbox/shell_progress_tests.rs
@@ -77,12 +77,12 @@ fn meter_treats_a_carriage_return_as_a_line_end() {
}
/// A 40s command that writes output reports twice, with the output it has
-/// written so far, through the meter scoped on its task.
+/// written so far, through the meter handed to the call.
#[tokio::test(start_paused = true)]
async fn a_long_call_reports_its_output_as_it_runs() {
let recorder = Recorder::default();
- let work = async {
- let meter = current_meter().expect("meter scoped on the call");
+ let work = |meter: Option<ShellOutputMeter>| async move {
+ let meter = meter.expect("meter handed to the call");
meter.record(b"Compiling a\n");
tokio::time::sleep(Duration::from_secs(20)).await;
meter.record(b"Compiling b\n");
@@ -104,13 +104,13 @@ async fn a_long_call_reports_its_output_as_it_runs() {
#[tokio::test(start_paused = true)]
async fn a_short_call_reports_nothing() {
let recorder = Recorder::default();
- let output = with_shell_progress(Some(&recorder), HEARTBEAT_INTERVAL, async { 7 }).await;
+ let output = with_shell_progress(Some(&recorder), HEARTBEAT_INTERVAL, |_| async { 7 }).await;
assert_eq!(output, 7);
assert!(recorder.updates.lock().unwrap().is_empty());
}
#[tokio::test]
-async fn without_a_context_no_meter_is_scoped() {
- let seen = with_shell_progress(None, HEARTBEAT_INTERVAL, async { current_meter() }).await;
+async fn without_a_context_no_meter_is_handed_out() {
+ let seen = with_shell_progress(None, HEARTBEAT_INTERVAL, |meter| async move { meter }).await;
assert!(seen.is_none());
}