1 import ./make-test-python.nix ({ pkgs, ... }: {
2 name = "service-runner";
3 meta = with pkgs.lib.maintainers; {
4 maintainers = [ roberth ];
8 machine = { pkgs, lib, ... }: {
9 services.nginx.enable = true;
10 services.nginx.virtualHosts.machine.root = pkgs.runCommand "webroot" {} ''
12 echo 'yay' >$out/index.html
14 systemd.services.nginx.enable = false;
19 testScript = { nodes, ... }: ''
20 url = "http://localhost/index.html"
22 with subtest("check systemd.services.nginx.runner"):
23 machine.fail(f"curl {url}")
26 mkdir -p /run/nginx /var/log/nginx /var/cache/nginx
27 ${nodes.machine.config.systemd.services.nginx.runner} >&2 &
31 machine.wait_for_open_port(80)
32 machine.succeed(f"curl -f {url}")
33 machine.succeed("kill -INT $(cat my-nginx.pid)")
34 machine.wait_for_closed_port(80)