1
0
Fork 1
mirror of https://github.com/NixOS/nixpkgs.git synced 2024-12-12 23:55:23 +00:00
nixpkgs/nixos/tests/ipfs.nix
Maximilian Güntner f7c099bd8c
tests: added basic ipfs test
$getter can be used once ipfs supports private/local networks
and or internet gets routed to the VMs

Signed-off-by: Maximilian Güntner <code@klandest.in>
2016-11-28 15:33:58 +01:00

38 lines
1.2 KiB
Nix

import ./make-test.nix ({ pkgs, ...} : {
name = "ipfs";
meta = with pkgs.stdenv.lib.maintainers; {
maintainers = [ mguentner ];
};
nodes = {
adder =
{ config, pkgs, ... }:
{
services.ipfs = {
enable = true;
gatewayAddress = "/ip4/127.0.0.1/tcp/2323";
apiAddress = "/ip4/127.0.0.1/tcp/2324";
};
};
getter =
{ config, pkgs, ... }:
{
services.ipfs.enable = true;
};
};
testScript = ''
startAll;
$adder->waitForUnit("ipfs");
# * => needs ipfs dht (internet)
# $getter->waitForUnit("ipfs");
$adder->waitUntilSucceeds("ipfs --api /ip4/127.0.0.1/tcp/2324 id");
$adder->mustSucceed("([[ -n '$(ipfs --api /ip4/127.0.0.1/tcp/2324 config Addresses.gatewayAddress | grep /ip4/127.0.0.1/tcp/2323)' ]])");
# * $getter->waitUntilSucceeds("ipfs --api /ip4/127.0.0.1/tcp/5001 id");
# * my $ipfsHash = $adder->mustSucceed("echo fnord | ipfs --api /ip4/127.0.0.1/tcp/2324 add | cut -d' ' -f2");
$adder->mustSucceed("([[ -n '$(echo fnord | ipfs --api /ip4/127.0.0.1/tcp/2324 add | grep added)' ]])");
# * $getter->mustSucceed("ipfs --api /ip4/127.0.0.1/tcp/5001 cat $ipfsHash");
'';
})