about summary refs log tree commit diff
path: root/nixos/tests/lighttpd.nix
blob: daef1584a45c712c7e76921bd688bacdfddffb79 (plain) (blame)
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
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}'"
    server.succeed("systemctl reload lighttpd")
  '';
})