depot/third_party/nixpkgs/nixos/tests/kubo/kubo-fuse.nix
Default email bcb2f287e1 Project import generated by Copybara.
GitOrigin-RevId: d603719ec6e294f034936c0d0dc06f689d91b6c3
2024-06-20 20:27:18 +05:30

42 lines
1.2 KiB
Nix

{ lib, ...} : {
name = "kubo-fuse";
meta = with lib.maintainers; {
maintainers = [ mguentner Luflosi ];
};
nodes.machine = { config, ... }: {
services.kubo = {
enable = true;
autoMount = true;
};
users.users.alice = {
isNormalUser = true;
extraGroups = [ config.services.kubo.group ];
};
users.users.bob = {
isNormalUser = true;
};
};
testScript = ''
start_all()
with subtest("FUSE mountpoint"):
machine.fail("echo a | su bob -l -c 'ipfs add --quieter'")
# The FUSE mount functionality is broken as of v0.13.0. This is still the case with v0.29.0.
# See https://github.com/ipfs/kubo/issues/9044.
# Workaround: using CID Version 1 avoids that.
ipfs_hash = machine.succeed(
"echo fnord3 | su alice -l -c 'ipfs add --quieter --cid-version=1'"
).strip()
machine.succeed(f"cat /ipfs/{ipfs_hash} | grep fnord3")
with subtest("Unmounting of /ipns and /ipfs"):
# 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"cat /ipfs/{ipfs_hash} | grep fnord3")
'';
}