blob: 79d96f739a6c8375a412eec63f0a939823a00e8c (
plain) (
blame)
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
|
import ./make-test-python.nix ({ pkgs, ... }: {
name = "service-runner";
meta = with pkgs.lib.maintainers; {
maintainers = [ roberth ];
};
nodes = {
machine = { pkgs, lib, ... }: {
services.nginx.enable = true;
services.nginx.virtualHosts.machine.root = pkgs.runCommand "webroot" {} ''
mkdir $out
echo 'yay' >$out/index.html
'';
systemd.services.nginx.enable = false;
};
};
testScript = { nodes, ... }: ''
url = "http://localhost/index.html"
with subtest("check systemd.services.nginx.runner"):
machine.fail(f"curl {url}")
machine.succeed(
"""
mkdir -p /run/nginx /var/log/nginx /var/cache/nginx
${nodes.machine.config.systemd.services.nginx.runner} >&2 &
echo $!>my-nginx.pid
"""
)
machine.wait_for_open_port(80)
machine.succeed(f"curl -f {url}")
machine.succeed("kill -INT $(cat my-nginx.pid)")
machine.wait_for_closed_port(80)
'';
})
|