about summary refs log tree commit diff
path: root/nixos
diff options
context:
space:
mode:
authorBruno BELANYI <bruno@belanyi.fr>2023-12-24 22:23:15 +0100
committerBruno BELANYI <bruno@belanyi.fr>2024-01-23 15:07:40 +0000
commit60518d6a5245bbd48b0d043549d6e22209474873 (patch)
tree3bfadd8eaf751038ae96e7214f7054dbb95720dd /nixos
parent70d0a6e54786994fb41f66796e20aff224028faa (diff)
downloadnixlib-60518d6a5245bbd48b0d043549d6e22209474873.tar
nixlib-60518d6a5245bbd48b0d043549d6e22209474873.tar.gz
nixlib-60518d6a5245bbd48b0d043549d6e22209474873.tar.bz2
nixlib-60518d6a5245bbd48b0d043549d6e22209474873.tar.lz
nixlib-60518d6a5245bbd48b0d043549d6e22209474873.tar.xz
nixlib-60518d6a5245bbd48b0d043549d6e22209474873.tar.zst
nixlib-60518d6a5245bbd48b0d043549d6e22209474873.zip
nixos/pyload: init test
Diffstat (limited to 'nixos')
-rw-r--r--nixos/tests/all-tests.nix1
-rw-r--r--nixos/tests/pyload.nix33
2 files changed, 34 insertions, 0 deletions
diff --git a/nixos/tests/all-tests.nix b/nixos/tests/all-tests.nix
index 25ee587e8f7a..fc1f047d42cf 100644
--- a/nixos/tests/all-tests.nix
+++ b/nixos/tests/all-tests.nix
@@ -387,6 +387,7 @@ in {
   installed-tests = pkgs.recurseIntoAttrs (handleTest ./installed-tests {});
   invidious = handleTest ./invidious.nix {};
   livebook-service = handleTest ./livebook-service.nix {};
+  pyload = handleTest ./pyload.nix {};
   oci-containers = handleTestOn ["aarch64-linux" "x86_64-linux"] ./oci-containers.nix {};
   odoo = handleTest ./odoo.nix {};
   odoo15 = handleTest ./odoo.nix { package = pkgs.odoo15; };
diff --git a/nixos/tests/pyload.nix b/nixos/tests/pyload.nix
new file mode 100644
index 000000000000..f913e822b2ff
--- /dev/null
+++ b/nixos/tests/pyload.nix
@@ -0,0 +1,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")
+  '';
+})