2020-05-08 11:48:47 +02:00
|
|
|
import ./make-test-python.nix ({ pkgs, ...} : {
|
2016-11-26 20:07:01 +01:00
|
|
|
name = "ipfs";
|
|
|
|
meta = with pkgs.stdenv.lib.maintainers; {
|
|
|
|
maintainers = [ mguentner ];
|
|
|
|
};
|
|
|
|
|
2020-05-08 11:48:47 +02:00
|
|
|
nodes.machine = { ... }: {
|
|
|
|
services.ipfs = {
|
|
|
|
enable = true;
|
2020-06-17 22:19:01 +02:00
|
|
|
# Also will add a unix domain socket socket API address, see module.
|
|
|
|
startWhenNeeded = true;
|
2020-05-08 11:48:47 +02:00
|
|
|
apiAddress = "/ip4/127.0.0.1/tcp/2324";
|
|
|
|
};
|
2016-11-26 20:07:01 +01:00
|
|
|
};
|
|
|
|
|
|
|
|
testScript = ''
|
2020-05-08 11:48:47 +02:00
|
|
|
start_all()
|
2017-08-30 15:20:10 +02:00
|
|
|
|
2020-06-17 22:19:01 +02:00
|
|
|
# IPv4 activation
|
|
|
|
|
|
|
|
machine.succeed("ipfs --api /ip4/127.0.0.1/tcp/2324 id")
|
2020-05-08 11:48:47 +02:00
|
|
|
ipfs_hash = machine.succeed(
|
|
|
|
"echo fnord | ipfs --api /ip4/127.0.0.1/tcp/2324 add | awk '{ print $2 }'"
|
|
|
|
)
|
2017-08-30 15:20:10 +02:00
|
|
|
|
2020-05-08 11:48:47 +02:00
|
|
|
machine.succeed(f"ipfs cat /ipfs/{ipfs_hash.strip()} | grep fnord")
|
2020-06-11 23:59:38 +02:00
|
|
|
|
2020-06-17 22:19:01 +02:00
|
|
|
# Unix domain socket activation
|
|
|
|
|
|
|
|
machine.stop_job("ipfs")
|
|
|
|
|
2020-06-11 23:59:38 +02: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-08 11:48:47 +02:00
|
|
|
'';
|
2016-11-26 20:07:01 +01:00
|
|
|
})
|