about summary refs log tree commit diff
path: root/nixos/tests/node-red.nix
blob: 5f5960d6829599429998434f94fe9fbfce8ec545 (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
import ./make-test-python.nix ({ pkgs, ... }: {
  name = "nodered";
  meta = with pkgs.lib.maintainers; {
    maintainers = [ matthewcroughan ];
  };

  nodes = {
    client = { config, pkgs, ... }: {
      environment.systemPackages = [ pkgs.curl ];
    };
    nodered = { config, pkgs, ... }: {
      services.node-red = {
        enable = true;
        openFirewall = true;
      };
    };
  };

  testScript = ''
    start_all()
    nodered.wait_for_unit("node-red.service")
    nodered.wait_for_open_port(1880)

    client.wait_for_unit("multi-user.target")

    with subtest("Check that the Node-RED webserver can be reached."):
        assert "<title>Node-RED</title>" in client.succeed(
            "curl -sSf http:/nodered:1880/ | grep title"
        )
  '';
})