about summary refs log tree commit diff
path: root/nixos/tests
diff options
context:
space:
mode:
authorh7x4 <h7x4@nani.wtf>2024-01-30 12:29:46 +0100
committerGitHub <noreply@github.com>2024-01-30 12:29:46 +0100
commitba5f81a6b69d4b1235ee70379c6bb3984afb5d59 (patch)
tree018a3c11808fb6bc0684842120bb95fda4b64932 /nixos/tests
parentae4e6de5b3c6dd077aa90b0e3ac3c0c9bcf45532 (diff)
parente837f4623dae23f7fa03120ee52740fd45bee682 (diff)
Merge pull request #276547 from ambroisie/pyload-module
nixos/pyload: init module
Diffstat (limited to 'nixos/tests')
-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 81bd36cf0e345..74de3fd1b77e8 100644
--- a/nixos/tests/all-tests.nix
+++ b/nixos/tests/all-tests.nix
@@ -390,6 +390,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 0000000000000..f913e822b2ff3
--- /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")
+  '';
+})