From f7c099bd8c9c2ad89408f3b689c06daa7ae654ac Mon Sep 17 00:00:00 2001 From: Maximilian Güntner Date: Sat, 26 Nov 2016 20:07:01 +0100 Subject: tests: added basic ipfs test MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit $getter can be used once ipfs supports private/local networks and or internet gets routed to the VMs Signed-off-by: Maximilian Güntner --- nixos/tests/ipfs.nix | 37 +++++++++++++++++++++++++++++++++++++ 1 file changed, 37 insertions(+) create mode 100644 nixos/tests/ipfs.nix (limited to 'nixos/tests/ipfs.nix') diff --git a/nixos/tests/ipfs.nix b/nixos/tests/ipfs.nix new file mode 100644 index 000000000000..92d742e4f37f --- /dev/null +++ b/nixos/tests/ipfs.nix @@ -0,0 +1,37 @@ + +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"); + ''; +}) -- cgit 1.4.1