summary refs log tree commit diff
path: root/nixos
diff options
context:
space:
mode:
authormatthewcroughan <matt@croughan.sh>2021-07-28 11:42:26 +0100
committermatthewcroughan <matt@croughan.sh>2021-07-28 17:32:45 +0100
commitb9c9d52aec8cc787629b4de6c7bb5732dca3ac0c (patch)
treea8471c2193fa51176d8f99515faf162e5ed59487 /nixos
parentbadbbb7e056e9252bc7ed98958a72a32957765a4 (diff)
downloadnixpkgs-b9c9d52aec8cc787629b4de6c7bb5732dca3ac0c.tar
nixpkgs-b9c9d52aec8cc787629b4de6c7bb5732dca3ac0c.tar.gz
nixpkgs-b9c9d52aec8cc787629b4de6c7bb5732dca3ac0c.tar.bz2
nixpkgs-b9c9d52aec8cc787629b4de6c7bb5732dca3ac0c.tar.lz
nixpkgs-b9c9d52aec8cc787629b4de6c7bb5732dca3ac0c.tar.xz
nixpkgs-b9c9d52aec8cc787629b4de6c7bb5732dca3ac0c.tar.zst
nixpkgs-b9c9d52aec8cc787629b4de6c7bb5732dca3ac0c.zip
nixos/node-red: add test
Diffstat (limited to 'nixos')
-rw-r--r--nixos/tests/all-tests.nix1
-rw-r--r--nixos/tests/node-red.nix31
2 files changed, 32 insertions, 0 deletions
diff --git a/nixos/tests/all-tests.nix b/nixos/tests/all-tests.nix
index 251f24a9a08..df384664f00 100644
--- a/nixos/tests/all-tests.nix
+++ b/nixos/tests/all-tests.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 {};
diff --git a/nixos/tests/node-red.nix b/nixos/tests/node-red.nix
new file mode 100644
index 00000000000..7660bc32f4c
--- /dev/null
+++ b/nixos/tests/node-red.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"
+        )
+  '';
+})