2020-05-15 21:57:56 +00:00
|
|
|
import ./make-test-python.nix ({ pkgs, ...} : {
|
2020-04-24 23:36:52 +00:00
|
|
|
name = "ipfs";
|
2021-01-15 22:18:51 +00:00
|
|
|
meta = with pkgs.lib.maintainers; {
|
2020-04-24 23:36:52 +00:00
|
|
|
maintainers = [ mguentner ];
|
|
|
|
};
|
|
|
|
|
2020-05-15 21:57:56 +00:00
|
|
|
nodes.machine = { ... }: {
|
|
|
|
services.ipfs = {
|
|
|
|
enable = true;
|
2020-06-15 15:56:04 +00:00
|
|
|
# Also will add a unix domain socket socket API address, see module.
|
|
|
|
startWhenNeeded = true;
|
2020-05-15 21:57:56 +00:00
|
|
|
apiAddress = "/ip4/127.0.0.1/tcp/2324";
|
|
|
|
};
|
2020-04-24 23:36:52 +00:00
|
|
|
};
|
|
|
|
|
|
|
|
testScript = ''
|
2020-05-15 21:57:56 +00:00
|
|
|
start_all()
|
2020-04-24 23:36:52 +00:00
|
|
|
|
2020-06-15 15:56:04 +00:00
|
|
|
# IPv4 activation
|
|
|
|
|
|
|
|
machine.succeed("ipfs --api /ip4/127.0.0.1/tcp/2324 id")
|
2020-05-15 21:57:56 +00:00
|
|
|
ipfs_hash = machine.succeed(
|
|
|
|
"echo fnord | ipfs --api /ip4/127.0.0.1/tcp/2324 add | awk '{ print $2 }'"
|
|
|
|
)
|
2020-04-24 23:36:52 +00:00
|
|
|
|
2020-05-15 21:57:56 +00:00
|
|
|
machine.succeed(f"ipfs cat /ipfs/{ipfs_hash.strip()} | grep fnord")
|
2020-06-18 07:06:33 +00:00
|
|
|
|
2020-06-15 15:56:04 +00:00
|
|
|
# Unix domain socket activation
|
|
|
|
|
|
|
|
machine.stop_job("ipfs")
|
|
|
|
|
2020-06-18 07:06:33 +00:00
|
|
|
ipfs_hash = machine.succeed(
|
|
|
|
"echo fnord2 | ipfs --api /unix/run/ipfs.sock add | awk '{ print $2 }'"
|
|
|
|
)
|
|
|
|
machine.succeed(
|
|
|
|
f"ipfs --api /unix/run/ipfs.sock cat /ipfs/{ipfs_hash.strip()} | grep fnord2"
|
|
|
|
)
|
2020-05-15 21:57:56 +00:00
|
|
|
'';
|
2020-04-24 23:36:52 +00:00
|
|
|
})
|