summaryrefslogtreecommitdiff
path: root/test/fs_namespace.zig
diff options
context:
space:
mode:
authorGabriel Schneider <[email protected]>2026-09-29 07:27:13 -0300
committerGabriel Schneider <[email protected]>2026-10-01 00:12:16 -0300
commit22fb8b6147f7fb72407af80c36d5e99e4664fea2 (patch)
tree0f5543812af5421a55d21e3bd95d929a19b48d82 /test/fs_namespace.zig
parentb3557640d6a0a4c2c41b6e1cae3c8182a32937ca (diff)
downloadpardes-22fb8b6147f7fb72407af80c36d5e99e4664fea2.tar.gz
pardes-22fb8b6147f7fb72407af80c36d5e99e4664fea2.zip
Mount dials its peer at once and fails if none answers; a peer out of reach is said as `dial failed: <reason>`
Mount took any well-formed dial and nothing was found out until the first look through it, which then said `look: look: dial`. Mount now probes the peer (version, attach, its root) with the turn out, and fails its write, mounting nothing, when none answers; the dial errors read as words, `no answer`, `timed out`, `hung up`, and a look through a peer gone since names its path: `look: /n/peer/f: dial failed: no answer`. Co-Authored-By: Claude Opus 5.5 <[email protected]>
Diffstat (limited to 'test/fs_namespace.zig')
-rw-r--r--test/fs_namespace.zig12
1 files changed, 9 insertions, 3 deletions
diff --git a/test/fs_namespace.zig b/test/fs_namespace.zig
index 2f78ca1a..bd620c2d 100644
--- a/test/fs_namespace.zig
+++ b/test/fs_namespace.zig
@@ -6,9 +6,15 @@ test "runtime Mount and Unmount copy command arguments and change Look resolutio
const gpa = std.testing.allocator;
const p = try pardes.Pardes.init(gpa, .{ .tty_only = true });
defer p.deinit();
- var command = "Mount peer /tmp/a socket.sock".*;
- try std.testing.expect(p.executeBuiltinLine(0, &command));
- @memset(&command, 'x');
+ // No peer answers at the dial: Mount mounts nothing (it dials first).
+ try std.testing.expect(p.executeBuiltinLine(0, "Mount peer /tmp/a socket.sock"));
+ try std.testing.expectEqual(@as(usize, 0), p.fs.mounts.items.len);
+ // Mounted (as one that answered is), its arguments are copies.
+ var name = "peer".*;
+ var dial = "/tmp/a socket.sock".*;
+ try p.fs.mount(gpa, &name, &dial);
+ @memset(&name, 'x');
+ @memset(&dial, 'x');
try std.testing.expectEqual(@as(usize, 1), p.fs.mounts.items.len);
try std.testing.expectEqualStrings("peer", p.fs.mounts.items[0].name);
try std.testing.expectEqualStrings("/tmp/a socket.sock", p.fs.mounts.items[0].dial);