Skip to content

Commit 6c5cf61

Browse files
committed
fix: update test_fs_read_bytes_capped to use FsRouter
Signed-off-by: danbugs <danilochiarlone@gmail.com>
1 parent 62cd0a6 commit 6c5cf61

1 file changed

Lines changed: 4 additions & 2 deletions

File tree

host/src/lib.rs

Lines changed: 4 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -2604,11 +2604,13 @@ mod tests {
26042604
// Without the cap this would try to allocate terabytes and OOM.
26052605
let root = tmpdir("readcap");
26062606
fs::write(root.join("small.bin"), b"hello").unwrap();
2607+
let preopens = vec![Preopen::new(&root, "/host").unwrap()];
26072608
let mut reg = ToolRegistry::new();
2608-
FsSandbox::new(&root).unwrap().register(&mut reg);
2609+
FsRouter::new(&preopens).unwrap().register(&mut reg);
26092610

26102611
// Ask for 1 TiB — the cap should silently clamp to MAX_FS_READ.
2611-
let req = br#"{"name":"fs_read_bytes","args":{"path":"small.bin","len":1099511627776}}"#;
2612+
let req =
2613+
br#"{"name":"fs_read_bytes","args":{"path":"/host/small.bin","len":1099511627776}}"#;
26122614
let resp = reg.dispatch(req);
26132615
let s = std::str::from_utf8(&resp).unwrap();
26142616
assert!(!s.contains("\"error\""), "should succeed: {s}");

0 commit comments

Comments
 (0)