nixos/tests/kubo: test new /mfs/ FUSE mount point
This commit is contained in:
parent
6af6c7ea8c
commit
27ab7b4f77
@ -43,11 +43,39 @@
|
|||||||
machine.succeed(f"diff /tmp/test.txt /ipfs/{ipfs_hash}")
|
machine.succeed(f"diff /tmp/test.txt /ipfs/{ipfs_hash}")
|
||||||
|
|
||||||
|
|
||||||
with subtest("Unmounting of /ipns and /ipfs"):
|
with subtest("/mfs/ FUSE mountpoint"):
|
||||||
|
with subtest("Write the test file in three different ways"):
|
||||||
|
machine.succeed("cp /tmp/test.txt /mfs/test-1.txt")
|
||||||
|
machine.succeed("su alice -c 'ipfs files write --create /test-2.txt < /tmp/test.txt'")
|
||||||
|
machine.succeed(f"ipfs files cp /ipfs/{ipfs_hash} /test-3.txt")
|
||||||
|
|
||||||
|
with subtest("Show the files (for debugging)"):
|
||||||
|
# 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.
|
||||||
|
machine.succeed("ipfs files ls --long >&2")
|
||||||
|
machine.succeed("ls -l /mfs >&2")
|
||||||
|
|
||||||
|
with subtest("Check that everyone has permission to read the file (because of Mounts.FuseAllowOther)"):
|
||||||
|
machine.succeed("su alice -c 'cat /mfs/test-1.txt' | grep fnord3")
|
||||||
|
machine.succeed("su bob -c 'cat /mfs/test-1.txt' | grep fnord3")
|
||||||
|
|
||||||
|
with subtest("Check the file contents"):
|
||||||
|
machine.succeed("diff /tmp/test.txt /mfs/test-1.txt")
|
||||||
|
machine.succeed("diff /tmp/test.txt /mfs/test-2.txt")
|
||||||
|
machine.succeed("diff /tmp/test.txt /mfs/test-3.txt")
|
||||||
|
|
||||||
|
with subtest("Check the CID extended attribute"):
|
||||||
|
output = machine.succeed(
|
||||||
|
"getfattr --only-values --name=ipfs_cid /mfs/test-3.txt"
|
||||||
|
).strip()
|
||||||
|
assert ipfs_hash == output, f"Expected {ipfs_hash} but got {output}"
|
||||||
|
|
||||||
|
|
||||||
|
with subtest("Unmounting of /ipns, /ipfs and /mfs"):
|
||||||
# Force Kubo to crash and wait for it to restart
|
# Force Kubo to crash and wait for it to restart
|
||||||
machine.systemctl("kill --signal=SIGKILL ipfs.service")
|
machine.systemctl("kill --signal=SIGKILL ipfs.service")
|
||||||
machine.wait_for_unit("ipfs.service", timeout = 30)
|
machine.wait_for_unit("ipfs.service", timeout = 30)
|
||||||
|
|
||||||
machine.succeed(f"diff /tmp/test.txt /ipfs/{ipfs_hash}")
|
machine.succeed(f"diff /tmp/test.txt /ipfs/{ipfs_hash}")
|
||||||
|
machine.succeed("diff /tmp/test.txt /mfs/test-3.txt")
|
||||||
'';
|
'';
|
||||||
}
|
}
|
||||||
|
Loading…
x
Reference in New Issue
Block a user