2020-05-08 10:48:47 +01:00
|
|
|
import ./make-test-python.nix ({ pkgs, ...} : {
|
2016-11-26 19:07:01 +00:00
|
|
|
name = "ipfs";
|
|
|
|
meta = with pkgs.stdenv.lib.maintainers; {
|
|
|
|
maintainers = [ mguentner ];
|
|
|
|
};
|
|
|
|
|
2020-05-08 10:48:47 +01:00
|
|
|
nodes.machine = { ... }: {
|
|
|
|
services.ipfs = {
|
|
|
|
enable = true;
|
|
|
|
apiAddress = "/ip4/127.0.0.1/tcp/2324";
|
|
|
|
};
|
2016-11-26 19:07:01 +00:00
|
|
|
};
|
|
|
|
|
|
|
|
testScript = ''
|
2020-05-08 10:48:47 +01:00
|
|
|
start_all()
|
|
|
|
machine.wait_for_unit("ipfs")
|
2017-08-30 14:20:10 +01:00
|
|
|
|
2020-05-08 10:48:47 +01:00
|
|
|
machine.wait_until_succeeds("ipfs --api /ip4/127.0.0.1/tcp/2324 id")
|
|
|
|
ipfs_hash = machine.succeed(
|
|
|
|
"echo fnord | ipfs --api /ip4/127.0.0.1/tcp/2324 add | awk '{ print $2 }'"
|
|
|
|
)
|
2017-08-30 14:20:10 +01:00
|
|
|
|
2020-05-08 10:48:47 +01:00
|
|
|
machine.succeed(f"ipfs cat /ipfs/{ipfs_hash.strip()} | grep fnord")
|
2020-06-11 22:59:38 +01: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 10:48:47 +01:00
|
|
|
'';
|
2016-11-26 19:07:01 +00:00
|
|
|
})
|