···
machine.succeed(f"diff /tmp/test.txt /ipfs/{ipfs_hash}")
46
-
with subtest("Unmounting of /ipns and /ipfs"):
46
+
with subtest("/mfs/ FUSE mountpoint"):
47
+
with subtest("Write the test file in three different ways"):
48
+
machine.succeed("cp /tmp/test.txt /mfs/test-1.txt")
49
+
machine.succeed("su alice -c 'ipfs files write --create /test-2.txt < /tmp/test.txt'")
50
+
machine.succeed(f"ipfs files cp /ipfs/{ipfs_hash} /test-3.txt")
52
+
with subtest("Show the files (for debugging)"):
53
+
# Different hashes for the different ways of adding the file to the MFS probably come from different linking structures of the merkle tree. Copying the file to /mfs with `cp` is even non-deterministic.
54
+
machine.succeed("ipfs files ls --long >&2")
55
+
machine.succeed("ls -l /mfs >&2")
57
+
with subtest("Check that everyone has permission to read the file (because of Mounts.FuseAllowOther)"):
58
+
machine.succeed("su alice -c 'cat /mfs/test-1.txt' | grep fnord3")
59
+
machine.succeed("su bob -c 'cat /mfs/test-1.txt' | grep fnord3")
61
+
with subtest("Check the file contents"):
62
+
machine.succeed("diff /tmp/test.txt /mfs/test-1.txt")
63
+
machine.succeed("diff /tmp/test.txt /mfs/test-2.txt")
64
+
machine.succeed("diff /tmp/test.txt /mfs/test-3.txt")
66
+
with subtest("Check the CID extended attribute"):
67
+
output = machine.succeed(
68
+
"getfattr --only-values --name=ipfs_cid /mfs/test-3.txt"
70
+
assert ipfs_hash == output, f"Expected {ipfs_hash} but got {output}"
73
+
with subtest("Unmounting of /ipns, /ipfs and /mfs"):
# Force Kubo to crash and wait for it to restart
machine.systemctl("kill --signal=SIGKILL ipfs.service")
machine.wait_for_unit("ipfs.service", timeout = 30)
machine.succeed(f"diff /tmp/test.txt /ipfs/{ipfs_hash}")
79
+
machine.succeed("diff /tmp/test.txt /mfs/test-3.txt")