nixos/node-red: add test

launchpad/nixpkgs/master
matthewcroughan 3 years ago
parent badbbb7e05
commit b9c9d52aec
  1. 1
      nixos/tests/all-tests.nix
  2. 31
      nixos/tests/node-red.nix

@ -280,6 +280,7 @@ in
nginx-variants = handleTest ./nginx-variants.nix {};
nix-ssh-serve = handleTest ./nix-ssh-serve.nix {};
nixos-generate-config = handleTest ./nixos-generate-config.nix {};
node-red = handleTest ./node-red.nix {};
nomad = handleTest ./nomad.nix {};
novacomd = handleTestOn ["x86_64-linux"] ./novacomd.nix {};
nsd = handleTest ./nsd.nix {};

@ -0,0 +1,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"
)
'';
})
Loading…
Cancel
Save