about summary refs log tree commit diff
path: root/nixos/tests/pyload.nix
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/tests/pyload.nix
parent70d0a6e54786994fb41f66796e20aff224028faa (diff)
nixos/pyload: init test
Diffstat (limited to 'nixos/tests/pyload.nix')
-rw-r--r--nixos/tests/pyload.nix33
1 files changed, 33 insertions, 0 deletions
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")
+  '';
+})