1 import ../make-test-python.nix ({ pkgs, lib, ... } : {
2 name = "static-web-server";
4 maintainers = with lib.maintainers; [ mac-chaffee ];
7 nodes.machine = { pkgs, ... }: {
8 services.static-web-server = {
11 root = toString (pkgs.writeTextDir "nixos-test.html" ''
15 general = { directory-listing = true; };
22 machine.wait_for_unit("static-web-server.socket")
23 machine.wait_for_open_port(8080)
24 # We don't use wait_until_succeeds() because we're testing socket
25 # activation which better work on the first request
26 response = machine.succeed("curl -fsS localhost:8080")
27 assert "nixos-test.html" in response, "The directory listing page did not include a link to our nixos-test.html file"
28 response = machine.succeed("curl -fsS localhost:8080/nixos-test.html")
29 assert "Hello NixOS!" in response
30 machine.wait_for_unit("static-web-server.service")