1 import ../make-test-python.nix (
4 name = "static-web-server";
6 maintainers = with lib.maintainers; [ mac-chaffee ];
12 services.static-web-server = {
16 pkgs.writeTextDir "nixos-test.html" ''
22 directory-listing = true;
30 machine.wait_for_unit("static-web-server.socket")
31 machine.wait_for_open_port(8080)
32 # We don't use wait_until_succeeds() because we're testing socket
33 # activation which better work on the first request
34 response = machine.succeed("curl -fsS localhost:8080")
35 assert "nixos-test.html" in response, "The directory listing page did not include a link to our nixos-test.html file"
36 response = machine.succeed("curl -fsS localhost:8080/nixos-test.html")
37 assert "Hello NixOS!" in response
38 machine.wait_for_unit("static-web-server.service")