diff options
author | Franz Pletz <fpletz@fnordicwalking.de> | 2017-08-30 18:50:40 +0200 |
---|---|---|
committer | GitHub <noreply@github.com> | 2017-08-30 18:50:40 +0200 |
commit | e3a8f58a215ddd1732a49b5db9f8ceab435cca51 (patch) | |
tree | fcd128c17618a5075f63d90f4e8289d273d58589 | |
parent | a22e1d4121c038c735d5a6e12d4b2b3e88881c79 (diff) | |
parent | a1302eab3ad89440edad3e5a360875ba97be1d17 (diff) | |
download | nixlib-e3a8f58a215ddd1732a49b5db9f8ceab435cca51.tar nixlib-e3a8f58a215ddd1732a49b5db9f8ceab435cca51.tar.gz nixlib-e3a8f58a215ddd1732a49b5db9f8ceab435cca51.tar.bz2 nixlib-e3a8f58a215ddd1732a49b5db9f8ceab435cca51.tar.lz nixlib-e3a8f58a215ddd1732a49b5db9f8ceab435cca51.tar.xz nixlib-e3a8f58a215ddd1732a49b5db9f8ceab435cca51.tar.zst nixlib-e3a8f58a215ddd1732a49b5db9f8ceab435cca51.zip |
Merge pull request #28746 from mguentner/ipfstest
tests: fix ipfs test, test actual networking functionality
-rw-r--r-- | nixos/tests/ipfs.nix | 38 |
1 files changed, 29 insertions, 9 deletions
diff --git a/nixos/tests/ipfs.nix b/nixos/tests/ipfs.nix index 92d742e4f37f..a93f8f175c55 100644 --- a/nixos/tests/ipfs.nix +++ b/nixos/tests/ipfs.nix @@ -11,27 +11,47 @@ import ./make-test.nix ({ pkgs, ...} : { { services.ipfs = { enable = true; + defaultMode = "norouting"; gatewayAddress = "/ip4/127.0.0.1/tcp/2323"; apiAddress = "/ip4/127.0.0.1/tcp/2324"; }; + networking.firewall.allowedTCPPorts = [ 4001 ]; }; getter = { config, pkgs, ... }: { - services.ipfs.enable = true; + services.ipfs = { + enable = true; + defaultMode = "norouting"; + # not yet. See #28621 + #autoMount = true; + }; + networking.firewall.allowedTCPPorts = [ 4001 ]; }; }; testScript = '' startAll; - $adder->waitForUnit("ipfs"); - # * => needs ipfs dht (internet) - # $getter->waitForUnit("ipfs"); + $adder->waitForUnit("ipfs-norouting"); + $getter->waitForUnit("ipfs-norouting"); + + # wait until api is available $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"); + my $addrId = $adder->succeed("ipfs --api /ip4/127.0.0.1/tcp/2324 id -f=\"<id>\""); + my $addrIp = (split /[ \/]+/, $adder->succeed("ip -o -4 addr show dev eth1"))[3]; + + $adder->mustSucceed("[ -n \"\$(ipfs --api /ip4/127.0.0.1/tcp/2324 config Addresses.Gateway | grep /ip4/127.0.0.1/tcp/2323)\" ]"); + + # wait until api is available + $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"); + chomp($ipfsHash); + + $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 swarm connect /ip4/$addrIp/tcp/4001/ipfs/$addrId"); + $getter->mustSucceed("[ -n \"\$(ipfs --api /ip4/127.0.0.1/tcp/5001 cat /ipfs/$ipfsHash | grep fnord)\" ]"); + # not yet. See #28621 + # $getter->mustSucceed("[ -n \"$(cat /ipfs/$ipfsHash | grep fnord)\" ]"); ''; }) |