recordbox: 0.8.3 -> 0.9.0 (#367826)
[NixPkgs.git] / nixos / tests / mycelium / default.nix
blob82ec074f77c441fe79196dd9ca458605550bcafc
1 import ../make-test-python.nix (
2   { lib, ... }:
3   let
4     peer1-ip = "538:f40f:1c51:9bd9:9569:d3f6:d0a1:b2df";
5     peer2-ip = "5b6:6776:fee0:c1f3:db00:b6a8:d013:d38f";
6   in
7   {
8     name = "mycelium";
9     meta.maintainers = with lib.maintainers; [ lassulus ];
11     nodes = {
13       peer1 =
14         { config, pkgs, ... }:
15         {
16           virtualisation.vlans = [ 1 ];
17           networking.interfaces.eth1.ipv4.addresses = [
18             {
19               address = "192.168.1.11";
20               prefixLength = 24;
21             }
22           ];
24           services.mycelium = {
25             enable = true;
26             addHostedPublicNodes = false;
27             openFirewall = true;
28             keyFile = ./peer1.key;
29             peers = [
30               "quic://192.168.1.12:9651"
31               "tcp://192.168.1.12:9651"
32             ];
33           };
34         };
36       peer2 =
37         { config, pkgs, ... }:
38         {
39           virtualisation.vlans = [ 1 ];
40           networking.interfaces.eth1.ipv4.addresses = [
41             {
42               address = "192.168.1.12";
43               prefixLength = 24;
44             }
45           ];
47           services.mycelium = {
48             enable = true;
49             addHostedPublicNodes = false;
50             openFirewall = true;
51             keyFile = ./peer2.key;
52           };
53         };
54     };
56     testScript = ''
57       start_all()
59       peer1.wait_for_unit("network-online.target")
60       peer2.wait_for_unit("network-online.target")
61       peer1.wait_for_unit("mycelium.service")
62       peer2.wait_for_unit("mycelium.service")
64       peer1.succeed("mycelium peers list | grep 192.168.1.12")
65       peer2.succeed("mycelium peers list | grep 192.168.1.11")
67       peer1.succeed("ping -c5 ${peer2-ip}")
68       peer2.succeed("ping -c5 ${peer1-ip}")
69     '';
70   }