about summary refs log tree commit diff
path: root/nixos/tests
diff options
context:
space:
mode:
authorBjørn Forsman <bjorn.forsman@gmail.com>2022-07-24 17:04:12 +0200
committerFranz Pletz <fpletz@fnordicwalking.de>2022-07-26 04:45:03 +0200
commit9b6965dcfcfc10906ee0ca955631a5a82d2a37ee (patch)
tree0ccc2e68796e3b5c5c78d001d5861e48cf87d9ff /nixos/tests
parent85caa4e62d14a301b56509007b3804e145902c83 (diff)
nixos: add lighttpd test
Diffstat (limited to 'nixos/tests')
-rw-r--r--nixos/tests/all-tests.nix1
-rw-r--r--nixos/tests/lighttpd.nix21
2 files changed, 22 insertions, 0 deletions
diff --git a/nixos/tests/all-tests.nix b/nixos/tests/all-tests.nix
index 03a7f17c07cc7..8d26845615f6f 100644
--- a/nixos/tests/all-tests.nix
+++ b/nixos/tests/all-tests.nix
@@ -282,6 +282,7 @@ in {
   libuiohook = handleTest ./libuiohook.nix {};
   lidarr = handleTest ./lidarr.nix {};
   lightdm = handleTest ./lightdm.nix {};
+  lighttpd = handleTest ./lighttpd.nix {};
   limesurvey = handleTest ./limesurvey.nix {};
   litestream = handleTest ./litestream.nix {};
   locate = handleTest ./locate.nix {};
diff --git a/nixos/tests/lighttpd.nix b/nixos/tests/lighttpd.nix
new file mode 100644
index 0000000000000..36e2745c55c15
--- /dev/null
+++ b/nixos/tests/lighttpd.nix
@@ -0,0 +1,21 @@
+import ./make-test-python.nix ({ lib, pkgs, ... }: {
+  name = "lighttpd";
+  meta.maintainers = with lib.maintainers; [ bjornfor ];
+
+  nodes = {
+    server = {
+      services.lighttpd.enable = true;
+      services.lighttpd.document-root = pkgs.runCommand "document-root" {} ''
+        mkdir -p "$out"
+        echo "hello nixos test" > "$out/file.txt"
+      '';
+    };
+  };
+
+  testScript = ''
+    start_all()
+    server.wait_for_unit("lighttpd.service")
+    res = server.succeed("curl --fail http://localhost/file.txt")
+    assert "hello nixos test" in res, f"bad server response: '{res}'"
+  '';
+})