about summary refs log tree commit diff
path: root/nixos/tests/pyload.nix
blob: f913e822b2ff3f2b1a35e426ea5e7fb4b90d520f (plain) (blame)
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
import ./make-test-python.nix ({ lib, ... }: {
  name = "pyload";
  meta.maintainers = with lib.maintainers; [ ambroisie ];

  nodes = {
    machine = { ... }: {
      services.pyload = {
        enable = true;

        listenAddress = "0.0.0.0";
        port = 9876;
      };

      networking.firewall.allowedTCPPorts = [ 9876 ];
    };

    client = { };
  };

  testScript = ''
    start_all()

    machine.wait_for_unit("pyload.service")

    with subtest("Web interface accessible locally"):
        machine.wait_until_succeeds("curl -fs localhost:9876")

    client.wait_for_unit("network.target")

    with subtest("Web interface accessible from a different machine"):
        client.wait_until_succeeds("curl -fs machine:9876")
  '';
})