nixosTests.node-red: migrate to runTest

Part of #386873
This commit is contained in:
Piotr Kwiecinski 2025-03-30 00:22:55 +01:00
parent c9947f03d1
commit 04456442cc
No known key found for this signature in database
GPG Key ID: EC0DE1CB9D5258B4
2 changed files with 32 additions and 34 deletions

View File

@ -846,7 +846,7 @@ in {
}; };
nixpkgs = pkgs.callPackage ../modules/misc/nixpkgs/test.nix { inherit evalMinimalConfig; }; nixpkgs = pkgs.callPackage ../modules/misc/nixpkgs/test.nix { inherit evalMinimalConfig; };
nixseparatedebuginfod = handleTest ./nixseparatedebuginfod.nix {}; nixseparatedebuginfod = handleTest ./nixseparatedebuginfod.nix {};
node-red = handleTest ./node-red.nix {}; node-red = runTest ./node-red.nix;
nomad = runTest ./nomad.nix; nomad = runTest ./nomad.nix;
non-default-filesystems = handleTest ./non-default-filesystems.nix {}; non-default-filesystems = handleTest ./non-default-filesystems.nix {};
non-switchable-system = runTest ./non-switchable-system.nix; non-switchable-system = runTest ./non-switchable-system.nix;

View File

@ -1,38 +1,36 @@
import ./make-test-python.nix ( { pkgs, ... }:
{ pkgs, ... }: {
{ name = "nodered";
name = "nodered"; meta = with pkgs.lib.maintainers; {
meta = with pkgs.lib.maintainers; { maintainers = [ matthewcroughan ];
maintainers = [ matthewcroughan ]; };
};
nodes = { nodes = {
client = client =
{ config, pkgs, ... }: { config, pkgs, ... }:
{ {
environment.systemPackages = [ pkgs.curl ]; environment.systemPackages = [ pkgs.curl ];
};
nodered =
{ config, pkgs, ... }:
{
services.node-red = {
enable = true;
openFirewall = true;
}; };
nodered = };
{ config, pkgs, ... }: };
{
services.node-red = {
enable = true;
openFirewall = true;
};
};
};
testScript = '' testScript = ''
start_all() start_all()
nodered.wait_for_unit("node-red.service") nodered.wait_for_unit("node-red.service")
nodered.wait_for_open_port(1880) nodered.wait_for_open_port(1880)
client.wait_for_unit("multi-user.target") client.wait_for_unit("multi-user.target")
with subtest("Check that the Node-RED webserver can be reached."): with subtest("Check that the Node-RED webserver can be reached."):
assert "<title>Node-RED</title>" in client.succeed( assert "<title>Node-RED</title>" in client.succeed(
"curl -sSf http:/nodered:1880/ | grep title" "curl -sSf http:/nodered:1880/ | grep title"
) )
''; '';
} }
)